Prado\Security\TAuthManager::login PHP 메소드

login() 공개 메소드

The username and password will be used to validate if login is successful. If yes, a user object will be created for the application.
public login ( $username, $password, $expire ) : boolean
리턴 boolean if login is successful
    public function login($username, $password, $expire = 0)
    {
        if ($this->_userManager->validateUser($username, $password)) {
            if (($user = $this->_userManager->getUser($username)) === null) {
                return false;
            }
            $this->updateSessionUser($user);
            $this->getApplication()->setUser($user);
            if ($expire > 0) {
                $cookie = new THttpCookie($this->getUserKey(), '');
                $cookie->setExpire(time() + $expire);
                $this->_userManager->saveUserToCookie($cookie);
                $this->getResponse()->getCookies()->add($cookie);
            }
            return true;
        } else {
            return false;
        }
    }