Skip to content

Commit

Permalink
Merge pull request #209 from tusharvikky/master
Browse files Browse the repository at this point in the history
[UPDATE] Make it easier for a user to have another activation email sent to them if necessary.
  • Loading branch information
rydurham committed Jun 30, 2016
2 parents f97a405 + 01b0d04 commit 592a1d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/Sentinel/Repositories/User/SentryUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,26 @@ public function store($data)
// Return a response
return new SuccessResponse($message, $payload);
} catch (UserExistsException $e) {
$message = trans('Sentinel::users.exists');
// If the User is already registered but hasn't yet completed the activation
// process resend the activation email and show appropriate message.

if ($this->config->get('sentinel.require_activation', true)) {

//Attempt to find the user.
$user = $this->sentry->getUserProvider()->findByLogin(e($data['email']));

// If the user is not currently activated resend the activation email
if (!$user->isActivated()) {
$this->dispatcher->fire('sentinel.user.resend', [
'user' => $user,
'activated' => $user->activated,
]);

return new FailureResponse(trans('Sentinel::users.pendingactivation'), ['user' => $user]);
}
}

$message = trans('Sentinel::users.exists');
return new ExceptionResponse($message);
}
}
Expand Down Expand Up @@ -255,7 +273,7 @@ public function resend($data)
// The user is trying to "reactivate" an account that doesn't exist. This could be
// a vector for determining valid existing accounts, so we will send a vague
// response without actually sending a new activation email.
$message = trans('Sentinel::users.emailconfirm');
$message = trans('Sentinel::users.pendingactivation');

return new SuccessResponse($message, []);
}
Expand Down
2 changes: 2 additions & 0 deletions src/lang/en/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

'alreadyactive' => "That account has already been activated.",

'pendingactivation' => "If an account for this email is found, you will receive the activation email in the next few minutes.",

'emailconfirm' => "Check your email for the confirmation link.",

'emailinfo' => "Check your email for instructions.",
Expand Down

0 comments on commit 592a1d6

Please sign in to comment.