Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function setConfirmed(string $token): void |
||
26 | { |
||
27 | if ($this->tokenizer->validate($token)) { |
||
28 | $user = User::find()->emailConfirmToken($token)->one(); |
||
29 | |||
30 | if ($user) { |
||
31 | $user->setConfirmed(); |
||
32 | if (!$user->save()) { |
||
33 | throw new Exception(Yii::t('app.msg', 'An error occurred while confirming')); |
||
34 | } |
||
35 | return; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | throw new BadRequestHttpException(Yii::t('app.msg', 'Invalid token for activate account')); |
||
40 | } |
||
41 | |||
71 |