| Conditions | 3 |
| Paths | 3 |
| Total Lines | 38 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function run() |
||
| 25 | { |
||
| 26 | $signupFormClass = Yii::$app->get('auth')->modelMap['signupForm']['class']; |
||
| 27 | $userClass = Yii::$app->get('auth')->modelMap['user']['class']; |
||
| 28 | $model = new $signupFormClass($this->scenario); |
||
| 29 | $user = new $userClass($this->scenario); |
||
| 30 | |||
| 31 | $isLoad = $model->load(Yii::$app->request->post()); |
||
| 32 | |||
| 33 | $this->trigger(static::EVENT_BEFORE_SIGNUP, new ActionEvent($this, [ |
||
| 34 | 'params' => [ |
||
| 35 | 'model' => $model, |
||
| 36 | 'user' => $user, |
||
| 37 | ] |
||
| 38 | ])); |
||
| 39 | |||
| 40 | if ($isLoad) { |
||
| 41 | if ($user = $model->signup($user)) { |
||
| 42 | $this->trigger(static::EVENT_AFTER_SIGNUP, new ActionEvent($this, [ |
||
| 43 | 'params' => [ |
||
| 44 | 'model' => $model, |
||
| 45 | 'user' => $user |
||
| 46 | ] |
||
| 47 | ])); |
||
| 48 | } else { |
||
| 49 | $this->trigger(static::EVENT_ERROR_SIGNUP, new ActionEvent($this, [ |
||
| 50 | 'params' => [ |
||
| 51 | 'model' => $model, |
||
| 52 | 'user' => $user |
||
| 53 | ] |
||
| 54 | ])); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | return $this->controller->render($this->view, [ |
||
| 59 | 'model' => $model, |
||
| 60 | ]); |
||
| 61 | } |
||
| 62 | |||
| 69 |