Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/UI/Components/Grids/Traits/ResetPassword/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ public function injectResetPassword(): void
$this['grid']->addAction('newPasswordAgain', 'Nové heslo', 'newPasswordAgain!')
->setIcon('lock')
->setConfirmation(new StringConfirmation('fcadmin.grids.user.confirms.newPassword'))
->setRenderCondition(fn(HasIdentity $hasIdentity) => $this->getCanResetPassword($hasIdentity))
->setClass(''); //je potreba, protoze se jinak aplikuje classa btn btn-primary atd. a prida pozadi -> skareda iknka
};
}

public function getCanResetPassword(HasIdentity $hasIdentity): bool
{
return (bool) $hasIdentity->getIdentity()->getEmail();
}

/**
* @throws DateMalformedStringException
* @throws InvalidArgument
Expand All @@ -45,6 +51,11 @@ public function handleNewPasswordAgain(int $id): void
$this->error();
}

if (!$this->getCanResetPassword($hasIdentity)) {
$this->getPresenter()->flashMessageError('fcadmin.grids.user.messages.mailErrorNoEmail');
$this->getPresenter()->redirect('this');
}

$identity = $hasIdentity->getIdentity();

// SSO (Keycloak) uživateli pošleme reset hesla přes Keycloak místo lokálního recovery mailu
Expand Down
1 change: 1 addition & 0 deletions src/lang/fcadmin.cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ grids:
messages:
mailSuccess: E-mail pro nastavení hesla byl odeslán
mailError: E-mail pro nastavení hesla se nepodařilo odeslat
mailErrorNoEmail: Uživatel nemá vyplněný e-mail, výzvu pro nastavení hesla nelze odeslat.
global:
isActive:
label: Aktivní
Expand Down
1 change: 1 addition & 0 deletions src/lang/fcadmin.sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ grids:
messages:
mailSuccess: E-mail pre nastavenie hesla bol odoslaný
mailError: E-mail pre nastavenie hesla sa nepodarilo odoslať
mailErrorNoEmail: Používateľ nemá vyplnený e-mail, výzvu pre nastavenie hesla nie je možné odoslať.
global:
isActive:
label: Aktívny
Expand Down