Skip to content

Commit

Permalink
[BUGFIX] Add unique message during invitation if profile is already c…
Browse files Browse the repository at this point in the history
…onfirmed
  • Loading branch information
sbusemann committed Jan 19, 2023
1 parent dbca7c4 commit 22d5ed8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Classes/Controller/InvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,19 @@ public function createAllConfirmed(User $user)
public function editAction($user, $hash = null): ResponseInterface
{
$user = $this->userRepository->findByUid($user);

// User must exist and hash must be valid
if ($user === null || !HashUtility::validHash($hash, $user)) {
$this->addFlashMessage(LocalizationUtility::translate('createFailedProfile'), '', AbstractMessage::ERROR);
$this->redirect('status');
}

// User must not be deleted (deleted = 0) and not be activated (disable = 1)
if ($user->getDisable() == 0) {
$this->addFlashMessage(LocalizationUtility::translate('userAlreadyConfirmed'), '', AbstractMessage::ERROR);
$this->redirect('status');
}

$user->setDisable(false);
$this->userRepository->update($user);
$this->persistenceManager->persistAll();
Expand Down

0 comments on commit 22d5ed8

Please sign in to comment.