Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function actionIndex($email, $username, $password) |
||
25 | { |
||
26 | $user = Yii::createObject([ |
||
27 | 'class' => UserModel::class, |
||
28 | 'scenario' => 'create', |
||
29 | 'email' => $email, |
||
30 | 'username' => $username, |
||
31 | 'plainPassword' => $password, |
||
32 | ]); |
||
33 | |||
34 | if ($user->create()) { |
||
35 | $this->stdout(Yii::t('yii2mod.user', 'User has been created.') . "!\n", Console::FG_GREEN); |
||
36 | } else { |
||
37 | $this->stdout(Yii::t('yii2mod.user', 'Please fix the following errors:') . "\n", Console::FG_RED); |
||
38 | foreach ($user->errors as $errors) { |
||
39 | foreach ($errors as $error) { |
||
40 | $this->stdout(' - ' . $error . "\n", Console::FG_RED); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |