當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。