本文整理汇总了PHP中Nette\Security\User::setExpiration方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setExpiration方法的具体用法?PHP User::setExpiration怎么用?PHP User::setExpiration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Security\User
的用法示例。
在下文中一共展示了User::setExpiration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formSucceeded
public function formSucceeded($form, $values)
{
$this->user->setExpiration('14 days', FALSE);
try {
$this->user->login($values->email, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($e->getMessage());
}
}
示例2: processForm
/**
* @param Form $form
*/
public function processForm(Form $form)
{
$values = $form->getValues();
try {
$this->user->login($values->username, $values->password);
$this->user->setExpiration('30 minutes', true);
$this->onSuccess();
} catch (AuthenticationException $e) {
$form->addError('Invalid credentials.');
}
}
示例3: processForm
/**
* @param \Nette\Application\UI\Form $form
*/
public function processForm(Form $form)
{
try {
if ($form->values->persistent) {
$this->user->setExpiration('+30 days', FALSE);
}
$this->user->login($form->values->email, $form->values->password);
} catch (AuthenticationException $e) {
$form->addError('Nesprávné uživatelské údaje');
}
}
示例4: formSucceeded
public function formSucceeded($form, $values)
{
// $stop();
$user = $this->userManager->add($values->fullname, $values->role, $values->email, $values->password);
if ($user == false) {
$form->addError('Tento email je již používán!');
} else {
$this->user->login($values->email, $values->password);
$this->user->setExpiration('14 days', FALSE);
}
}
示例5: formSucceeded
public function formSucceeded(Form $form, $values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->email, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($form->translate('errors.wrong_login'));
}
}
示例6: formSucceeded
public function formSucceeded(Form $oForm, $oValues)
{
if ($oValues->remember) {
$this->oUser->setExpiration('14 days', FALSE);
} else {
$this->oUser->setExpiration('20 minutes', TRUE);
}
try {
$this->oUser->login($oValues->username, $oValues->password);
} catch (Nette\Security\AuthenticationException $e) {
$oForm->addError("Špatný login nebo heslo.");
}
}
示例7: formSucceeded
public function formSucceeded(Form $form, \stdClass $values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->username, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError('Přihlašovací údaje nejsou správné.');
}
}
示例8: formSucceeded
/**
* Prihlaseni uzivatele
* @param Form $form
* @param ArrayHash $values
*/
public function formSucceeded(Form $form, $values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->username, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($form->getTranslator()->translate('system.credentialsLogError'));
}
}
示例9: signIn
public function signIn(IUser $user)
{
$this->onSignIn($user);
if ($this->expiration !== NULL) {
$this->security->setExpiration($this->expiration);
}
if ($this->backlink !== NULL) {
$presenter = $this->application->getPresenter();
if (isset($presenter->{$this->backlink})) {
$presenter->restoreRequest($presenter->{$this->backlink});
}
}
}
示例10: formSucceeded
public function formSucceeded(Form $form, $values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->username, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError('The username or password you entered is incorrect.');
}
}
示例11: formSucceeded
public function formSucceeded(Form $form, $values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->username, $values->password);
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($e->getMessage());
}
}
示例12: process
public function process(Form $form)
{
$values = $form->values;
try {
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration(0, TRUE);
}
$this->user->login($values->username, $values->password);
} catch (AuthenticationException $e) {
$form->addError($e->getMessage());
}
}
示例13: processForm
public function processForm($values)
{
if ($values->remember) {
$this->user->setExpiration('14 days', FALSE);
} else {
$this->user->setExpiration('20 minutes', TRUE);
}
try {
$this->user->login($values->username, $values->password);
$this->presenter->redirect("Homepage:");
} catch (Nette\Security\AuthenticationException $e) {
$this->addError($e->getMessage());
}
}
示例14: formSucceeded
public function formSucceeded(RegistrationForm $form)
{
if ($form['remember']->getValue()) {
$this->user->setExpiration('14 days', false);
} else {
$this->user->setExpiration('20 minutes', true);
}
$date = DateTime::createFromFormat('Y-m-d', date("Y-m-d"));
try {
$this->manager->add($form['username']->getValue(), $form['password']->getValue(), $form['email']->getValue(), $date);
$this->user->login($form['username']->getValue(), $form['password']->getValue());
} catch (Nette\Security\AuthenticationException $e) {
$form->addError($e->getMessage());
}
}
示例15: process
public function process(Form $form)
{
$values = $form->getValues();
try {
$this->userSecurity->setExpiration('+ 14 days', FALSE);
$this->userSecurity->login($values->email, $values->pass);
} catch (\Exception $e) {
throw $e;
$form->addError("We are sorry, error occured during login process");
return;
}
// restore backlink if exists
$form->presenter->restoreRequest($form->presenter->backlink);
// or redirect
$form->presenter->redirect(':Admin:ErrorList:');
}