public function adminLogin($username, $password) { $row = $this->database->table('loginadmin')->where('name', $username)->fetch(); if (!$row) { throw new Nette\Security\AuthenticationException('Nesprávné přihlašovací jméno.'); } if (!($password == $row['password'])) { throw new Nette\Security\AuthenticationException('Nesprávné heslo.'); } $this->user->getStorage()->setNamespace('App\\AdminModule'); $this->user->login(new Nette\Security\Identity($row['id'], $row['name'])); }
public function onLoggedOut(Security $security) { // BUG: Nette\Security\User 2.1 fires onLoggedOut before clearing storage if ($user = $this->repository->find($security->getIdentity()->getId())) { $security->getStorage()->setAuthenticated(FALSE); $this->user->signOut($user); } }
/** * @param \Nette\Security\User $user */ public function setup(User $user) { $user->getStorage()->setNamespace($this->namespace); $user->setAuthenticator($this->authenticator); $user->setAuthorizator($this->authorizator); }
/** * @param bool $isAuthenticated */ public function setAuthenticated($isAuthenticated) { $this->user->getStorage()->setAuthenticated($isAuthenticated); }