Skip to content

Commit

Permalink
generate conf. token if the user doesn't have one
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylhein authored Jan 16, 2019
1 parent 39073a3 commit ee71a1b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Controller/RegistrationConfirmationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ public function resendAction(Request $request, User $user = null)
$this->addFlash('warning', 'Your account is already enabled.');
} else {
$this->addFlash('warning', 'The user is already enabled.');

}

return $this->redirect($redirect);
}

if (null === $user->getConfirmationToken()) {
throw new \InvalidArgumentException(
'The user does not have a confirmation token and therefore cannot be activated.'
$user->setConfirmationToken(
$this->get('fos_user.util.token_generator')
->generateToken()
);
$this->get('fos_user.user_manager')->updateUser($user);
}

$this->get('fos_user.mailer')->sendConfirmationEmailMessage($user);
Expand All @@ -78,4 +79,4 @@ public function resendAction(Request $request, User $user = null)

return $this->redirect($redirect);
}
}
}

0 comments on commit ee71a1b

Please sign in to comment.