Пример #1
0
 public function actionLogin($login = null)
 {
     if (null !== $login) {
         try {
             $identity = new Identity();
             $user = $identity->authenticate($login);
             $this->app->flash->message = 'Добро пожаловать, ' . $user->email . '!';
             $this->redirect('/');
         } catch (\App\Components\Auth\MultiException $e) {
             $this->data->errors = $e;
         }
         $this->data->email = $login->email;
     }
 }
Пример #2
0
 public function actionLogin($email = null, $password = null)
 {
     $this->data->error = $this->app->flash->error;
     if (!empty($email) && !empty($password)) {
         try {
             $identity = new Identity();
             $identity->authenticate(new Std(['email' => $email, 'password' => $password]));
             $this->redirect('/');
         } catch (Exception $e) {
             $this->app->flash->error = $e->getMessage();
         }
     }
     $this->data->email = $email;
 }