Code Duplication    Length = 12-13 lines in 3 locations

models/forms/ResendForm.php 1 location

@@ 42-53 (lines=12) @@
39
     * @return bool
40
     * @throws yii\base\InvalidConfigException
41
     */
42
    public function resend()
43
    {
44
        if (!$this->validate()) {
45
            return false;
46
        }
47
        /** @var \inblank\activeuser\models\User $user */
48
        $user = Yii::createObject(self::di('User'))->findOne(['email' => $this->email]);
49
        if ($user) {
50
            $user->resend();
51
        }
52
        return true;
53
    }
54
}
55

models/forms/RestoreForm.php 2 locations

@@ 53-64 (lines=12) @@
50
     * @return bool
51
     * @throws yii\base\InvalidConfigException
52
     */
53
    public function restore()
54
    {
55
        if (!$this->validate()) {
56
            return false;
57
        }
58
        /** @var \inblank\activeuser\models\User $user */
59
        $user = Yii::createObject(self::di('User'))->findOne(['email' => $this->email]);
60
        if ($user) {
61
            $user->restore();
62
        }
63
        return true;
64
    }
65
    /**
66
     * Change password
67
     * @return bool
@@ 70-82 (lines=13) @@
67
     * @return bool
68
     * @throws yii\base\InvalidConfigException
69
     */
70
    public function changePassword()
71
    {
72
        if (!$this->validate()) {
73
            return false;
74
        }
75
        /** @var \inblank\activeuser\models\User $user */
76
        $user = Yii::createObject(self::di('User'))->findOne(['email' => $this->email]);
77
        if ($user) {
78
            $user->password = $this->password;
79
            $user->newPassword();
80
        }
81
        return true;
82
    }
83
}
84