@@ 28-36 (lines=9) @@ | ||
25 | { |
|
26 | if ($this->confirm(Yii::t('yii2mod.user', 'Are you sure you want to delete this user?'))) { |
|
27 | $user = UserModel::findByEmail($email); |
|
28 | if ($user === null) { |
|
29 | $this->stdout(Yii::t('yii2mod.user', 'User is not found.') . "\n", Console::FG_RED); |
|
30 | } else { |
|
31 | if ($user->delete()) { |
|
32 | $this->stdout(Yii::t('yii2mod.user', 'User has been deleted.') . "\n", Console::FG_GREEN); |
|
33 | } else { |
|
34 | $this->stdout(Yii::t('yii2mod.user', 'Error occurred while deleting user.') . "\n", Console::FG_RED); |
|
35 | } |
|
36 | } |
|
37 | } |
|
38 | ||
39 | return self::EXIT_CODE_NORMAL; |
@@ 29-37 (lines=9) @@ | ||
26 | { |
|
27 | $user = UserModel::findByEmail($email); |
|
28 | ||
29 | if ($user === null) { |
|
30 | $this->stdout(Yii::t('yii2mod.user', 'User is not found.') . "\n", Console::FG_RED); |
|
31 | } else { |
|
32 | if ($user->resetPassword($password)) { |
|
33 | $this->stdout(Yii::t('yii2mod.user', 'Password has been changed.') . "\n", Console::FG_GREEN); |
|
34 | } else { |
|
35 | $this->stdout(Yii::t('yii2mod.user', 'Error occurred while changing password.') . "\n", Console::FG_RED); |
|
36 | } |
|
37 | } |
|
38 | ||
39 | return self::EXIT_CODE_NORMAL; |
|
40 | } |