Created
June 30, 2011 23:18
-
-
Save Majkl578/1057527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//presenter | |
protected function createComponentLoginForm($name) | |
{ | |
$form = new NAppForm($this, $name); | |
$form->addText('username', 'Už. jméno')->setRequired(); | |
$form->addPassword('password', 'Heslo')->setRequired(); | |
$form->addSubmit('submitter', 'Přihlásit se'); | |
$form->onSuccess[] = callback($this, 'loginFormSubmitted'); //5.2 | |
} | |
public function loginFormSubmitted($form) | |
{ | |
$values = $form->values; | |
try { | |
$this->getUser()->login($values->username, $values->password); | |
$this->getApplication()->restoreRequest($this->backlink); | |
$this->redirect('Homepage:'); | |
} catch (NAuthenticationException $e) { | |
$this->flashMessage('Authentication failed', 'error'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{* latte šablona *} | |
<div id="login" > | |
{form loginForm} | |
<div class="inputl"><span>{label username /}</span>{input username}</div> | |
<div class="inputl"><span>{label password /}</span>{input password}</div> | |
<div class="inputs">{input submitter}</div> | |
{/form} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment