/** * Authenticate user * @param string $username Username * @param string $password Password */ public function login() { $username = $this->getArg('username'); $password = $this->getArg('password'); if (!$username) { return $this->error('invalid username'); } if (!$password) { return $this->error('invalid password'); } if (\Sonic\Model\User::_Login($username, $password) instanceof \Sonic\Model\User) { $this->success(); } else { return $this->error('incorrect username and/or password'); } }
/** * Authenticate user * @param string $username Username * @param string $password Password */ public function login() { $username = $this->getArg('username'); $password = $this->getArg('password'); $this->template = 'admin/login.tpl'; if (!$username) { new \Sonic\Message('error', 'Invalid username'); return; } if (!$password) { new \Sonic\Message('error', 'Invalid password'); return; } if (\Sonic\Model\User::_Login($username, $password) instanceof \Sonic\Model\User) { new \Sonic\Resource\Redirect('/admin/index'); return; } else { new \Sonic\Message('error', 'incorrect username and/or password'); return; } }