@@ -152,6 +152,10 @@ public function actionAuthorizeAuthClient()
152
152
*/
153
153
public function actionLogin ()
154
154
{
155
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
156
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
157
+ }
158
+
155
159
$ model = new LoginForm ();
156
160
157
161
$ model ->load (Yii::$ app ->request ->post ());
@@ -171,6 +175,10 @@ public function actionLogin()
171
175
*/
172
176
public function actionRegister ()
173
177
{
178
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
179
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
180
+ }
181
+
174
182
$ model = new UserCreateForm (['scenario ' => UserCreateForm::SCENARIO_REGULAR ]);
175
183
176
184
$ model ->load (Yii::$ app ->request ->post ());
@@ -216,6 +224,10 @@ public function actionActivate()
216
224
*/
217
225
public function actionRequestPasswordReset ()
218
226
{
227
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
228
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
229
+ }
230
+
219
231
$ model = new UserPasswordResetRequestForm ();
220
232
221
233
$ model ->load (Yii::$ app ->request ->post ());
@@ -236,6 +248,10 @@ public function actionRequestPasswordReset()
236
248
*/
237
249
public function actionConfirmPasswordReset ()
238
250
{
251
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
252
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
253
+ }
254
+
239
255
$ model = new UserPasswordResetForm ();
240
256
241
257
$ model ->load (Yii::$ app ->request ->post ());
@@ -254,6 +270,10 @@ public function actionConfirmPasswordReset()
254
270
*/
255
271
public function actionRequestEmailChange ()
256
272
{
273
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
274
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
275
+ }
276
+
257
277
$ model = new UserEmailChangeRequestForm (Yii::$ app ->user ->identity );
258
278
259
279
$ model ->load (Yii::$ app ->request ->post ());
@@ -274,6 +294,10 @@ public function actionRequestEmailChange()
274
294
*/
275
295
public function actionConfirmEmailChange ()
276
296
{
297
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
298
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
299
+ }
300
+
277
301
try {
278
302
$ token = CastHelper::toString (Yii::$ app ->request ->post ('token ' ));
279
303
$ user = User::changeEmailByEmailChangeToken ($ token );
@@ -366,6 +390,10 @@ public function actionView($id)
366
390
*/
367
391
public function actionCreate ()
368
392
{
393
+ if (empty (Yii::$ app ->params ['emailPasswordAuth ' ])) {
394
+ return $ this ->sendErrorResponse ([], Yii::t ('app ' , 'Email/Password authorization is disabled. ' ));
395
+ }
396
+
369
397
$ user = Yii::$ app ->user ->identity ;
370
398
if (!$ user ->isSuperUser ()) {
371
399
throw new ForbiddenHttpException ('You are not allowed to create user accounts. ' );
0 commit comments