@@ -23,7 +23,11 @@ class UserController extends ParentController
23
23
{
24
24
public $ controller_id = 1001 ;
25
25
26
- public $ full_access_actions = ['login ' , 'logout ' , 'request-password-reset ' , 'reset-password ' , 'set-new-email ' , 'change-password ' ];
26
+ public $ full_access_actions = [
27
+ 'login ' , 'logout ' ,
28
+ 'request-password-reset ' , 'reset-password ' , 'set-new-email ' , 'change-password ' ,
29
+ 'profile '
30
+ ];
27
31
28
32
/**
29
33
* Lists all User models.
@@ -232,7 +236,7 @@ public function actionSetNewEmail($username, $email, $key)
232
236
*/
233
237
public function actionChangePassword ()
234
238
{
235
- // not guest cannot change password
239
+ // guest cannot change password
236
240
if (Yii::$ app ->user ->isGuest ) {
237
241
return $ this ->goHome ();
238
242
}
@@ -278,10 +282,24 @@ public function actionLogin()
278
282
}
279
283
280
284
$ model ->password = '' ;
285
+
281
286
return $ this ->render ('login ' , [
282
287
'model ' => $ model ,
283
288
]);
284
289
}
290
+
291
+ public function actionProfile ()
292
+ {
293
+
294
+ // guest cannot view profile
295
+ if (Yii::$ app ->user ->isGuest ) {
296
+ return $ this ->goHome ();
297
+ }
298
+
299
+ return $ this ->render ('profile ' , [
300
+ 'model ' => Yii::$ app ->user ->identity ,
301
+ ]);
302
+ }
285
303
286
304
/**
287
305
* Finds the User model based on its primary key value.
0 commit comments