Skip to content

Commit

Permalink
Merge pull request #5 from Pletacka-IoT/dev
Browse files Browse the repository at this point in the history
Add translate sign
  • Loading branch information
JakubAndrysek authored Oct 31, 2020
2 parents 6140a64 + d057d29 commit 8b0bd62
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/CoreModule/Presenters/templates/Sign/in.latte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{block content}
<h1 n:block=title>Sign In</h1>
<h1 n:block=title>Přihlašování</h1>

{include sign-form signInForm}

Expand Down
4 changes: 2 additions & 2 deletions app/CoreModule/Presenters/templates/Sign/out.latte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{block content}
<h1 n:block=title>You have been signed out</h1>
<h1 n:block=title>Byl ji odhlášen</h1>

<p><a class="ajax" n:href="in">Sign in to another account</a></p>
<p><a class="ajax" n:href="in">Přihlaš se pomocí jiného účtu</a></p>
4 changes: 2 additions & 2 deletions app/CoreModule/Presenters/templates/Sign/up.latte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{block content}
<h1 n:block=title>Sign Up</h1>
<h1 n:block=title>Registrace</h1>

{include sign-form signUpForm}

<p><a class="ajax" n:href="in">Already have an account? Log in.</a></p>
<div><a class="ajax" n:href="in">Již máš účet? Přihlaš se</a></div>
14 changes: 7 additions & 7 deletions app/Forms/SignUpFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ public function __construct(FormFactory $factory, Model\UserManager $userManager
public function create(callable $onSuccess): Form
{
$form = $this->factory->create();
$form->addText('username', 'Pick a username:')
->setRequired('Please pick a username.');
$form->addText('username', 'Jméno:')
->setRequired('Zadejte prosím uživatelské jméno');

$form->addPassword('password', 'Create a password:')
->setOption('description', sprintf('at least %d characters', self::PASSWORD_MIN_LENGTH))
->setRequired('Please create a password.')
$form->addPassword('password', 'Heslo')
->setOption('description', sprintf('alespoň %d znaků', self::PASSWORD_MIN_LENGTH))
->setRequired('Zadejte prosím uživatelské heslo')
->addRule($form::MIN_LENGTH, null, self::PASSWORD_MIN_LENGTH);

$form->addSubmit('send', 'Sign up');
$form->addSubmit('send', 'Registrovat');

$form->onSuccess[] = function (Form $form, \stdClass $values) use ($onSuccess): void {
try {
$this->userManager->add($values->username, $values->password);
$this->user->login($values->username, $values->password);

} catch (Model\DuplicateNameException $e) {
$form['username']->addError('Username is already taken.');
$form['username']->addError('Uživatelské jméno je již obsazeno');
return;
}
$onSuccess();
Expand Down

0 comments on commit 8b0bd62

Please sign in to comment.