1 | <?php |
||
19 | class IndexController extends BaseController |
||
20 | { |
||
21 | /** |
||
22 | * @inheritdoc |
||
23 | */ |
||
24 | 58 | public function behaviors() |
|
25 | { |
||
26 | return [ |
||
27 | 'access' => [ |
||
28 | 58 | 'class' => AccessControl::className(), |
|
29 | 'only' => ['logout', 'signup', 'signup-provider', 'auth', 'confirm-request'], |
||
30 | 'rules' => [ |
||
31 | [ |
||
32 | 'actions' => ['signup', 'signup-provider', 'auth'], |
||
33 | 'allow' => true, |
||
34 | 'roles' => ['?'], |
||
35 | ], |
||
36 | [ |
||
37 | 'actions' => ['logout', 'confirm-request'], |
||
38 | 'allow' => true, |
||
39 | 'roles' => ['@'], |
||
40 | ], |
||
41 | ], |
||
42 | 58 | ], |
|
43 | 'verbs' => [ |
||
44 | 58 | 'class' => VerbFilter::className(), |
|
45 | 'actions' => [ |
||
46 | 'logout' => ['post'], |
||
47 | ], |
||
48 | ], |
||
49 | ]; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @inheritdoc |
||
54 | */ |
||
55 | 58 | public function actions() |
|
68 | |||
69 | 8 | public function successCallback($client) |
|
77 | |||
78 | 25 | public function actionIndex() |
|
82 | |||
83 | 16 | public function actionLogin() |
|
97 | |||
98 | 15 | public function actionSignup() |
|
131 | |||
132 | 9 | public function actionSignupProvider() |
|
133 | { |
||
134 | 9 | $session = Yii::$app->session; |
|
135 | 9 | $provider = $session['provider']; |
|
136 | 9 | if ($provider === null) { |
|
137 | 1 | return $this->goHome(); |
|
138 | } |
||
139 | |||
140 | 8 | $model = new SignupProviderForm($provider); |
|
141 | |||
142 | // check exist user and provider |
||
143 | 8 | if ($user = User::findByProvider($provider['type'], $provider['profile']['id'])) { |
|
144 | 2 | $session['provider'] = null; |
|
145 | 2 | if ($user->isActive()) { |
|
146 | 1 | $user->updateProvider($model->parseProvider()); |
|
|
|||
147 | 1 | $user->authorize(true); |
|
148 | 1 | return $this->goHome(); |
|
149 | } |
||
150 | 1 | $session->setFlash('error', $user->getStatusDescription()); |
|
151 | 1 | return $this->goHome(); |
|
152 | } |
||
153 | |||
154 | 8 | $model->prepareUser(); |
|
155 | |||
156 | 8 | if ($model->isVerifiedEmail() && $model->signup(false)) { |
|
157 | 1 | $session['provider'] = null; |
|
158 | 1 | return $this->goHome(); |
|
159 | } |
||
160 | |||
161 | 7 | if ($model->load(Yii::$app->request->post()) && $model->signup()) { |
|
162 | 5 | $session['provider'] = null; |
|
163 | 5 | if ($model->sendEmail()) { |
|
164 | 4 | $session->setFlash( |
|
165 | 4 | 'success', |
|
166 | 4 | Yii::t( |
|
167 | 4 | 'app.messages', |
|
168 | 4 | 'Please activate your account' |
|
169 | 4 | ) . '. ' . |
|
170 | 4 | Yii::t( |
|
171 | 4 | 'app.messages', |
|
172 | 4 | 'A letter for activation was sent to {email}', |
|
173 | 4 | ['email' => $model->email] |
|
174 | ) |
||
175 | ); |
||
176 | 4 | return $this->goHome(); |
|
177 | } |
||
178 | 1 | $session->setFlash( |
|
179 | 1 | 'error', |
|
180 | 1 | Yii::t( |
|
181 | 1 | 'app.messages', |
|
182 | 1 | 'An error occurred while sending a message to activate account' |
|
183 | ) |
||
184 | ); |
||
185 | 1 | return $this->goHome(); |
|
186 | } |
||
187 | |||
188 | 7 | return $this->render('signupProvider', [ |
|
189 | 7 | 'model' => $model |
|
190 | ]); |
||
191 | } |
||
192 | |||
193 | 3 | public function actionConfirmRequest() |
|
222 | |||
223 | 3 | public function actionConfirmEmail($token) |
|
243 | |||
244 | 8 | public function actionRequestPasswordReset() |
|
273 | |||
274 | 6 | public function actionResetPassword($token) |
|
301 | |||
302 | 1 | public function actionLogout() |
|
307 | |||
308 | /** @see commands/MaintenanceController **/ |
||
309 | 2 | public function actionMaintenance() |
|
318 | } |
||
319 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.