当前位置: 首页>>代码示例>>PHP>>正文


PHP User::setExpiration方法代码示例

本文整理汇总了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());
     }
 }
开发者ID:Vesely,项目名称:rocnikac,代码行数:9,代码来源:SignInFormFactory.php

示例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.');
     }
 }
开发者ID:joseki,项目名称:sandbox,代码行数:14,代码来源:SignInControl.php

示例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');
     }
 }
开发者ID:Kotys,项目名称:eventor.io,代码行数:14,代码来源:SignInForm.php

示例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);
     }
 }
开发者ID:Vesely,项目名称:rocnikac,代码行数:11,代码来源:SignUpFormFactory.php

示例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'));
     }
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:13,代码来源:SignFormFactory.php

示例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.");
     }
 }
开发者ID:GreenOceanCZ,项目名称:kelio-test,代码行数:13,代码来源:SignFormFactory.php

示例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é.');
     }
 }
开发者ID:ParalelniPolis,项目名称:bitcoinJukebox,代码行数:13,代码来源:SignFormFactory.php

示例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'));
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:18,代码来源:SignFormFactory.php

示例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});
         }
     }
 }
开发者ID:rixxi,项目名称:user,代码行数:13,代码来源:User.php

示例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.');
     }
 }
开发者ID:pzdesign,项目名称:patrik-zizka-nette,代码行数:13,代码来源:SignFormFactory.php

示例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());
     }
 }
开发者ID:jave007,项目名称:test,代码行数:13,代码来源:SignFormFactory.php

示例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());
     }
 }
开发者ID:chapcz,项目名称:Admin,代码行数:14,代码来源:LoginFormFactory.php

示例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());
     }
 }
开发者ID:Blizqery,项目名称:Boilerplate,代码行数:14,代码来源:SignForm.php

示例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());
     }
 }
开发者ID:04EO,项目名称:hup-nette,代码行数:15,代码来源:RegistrationFormFactory.php

示例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:');
 }
开发者ID:RiKap,项目名称:ErrorMonitoring,代码行数:16,代码来源:LoginFormFactory.php


注:本文中的Nette\Security\User::setExpiration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。