Some more confirmation things.

This commit is contained in:
James Cole 2016-03-29 13:52:51 +02:00
parent 2d3f3f0fde
commit c6ac81dcf6
3 changed files with 9 additions and 3 deletions

View File

@ -67,11 +67,12 @@ class UserConfirmation
// if user must confirm account, send email
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
// otherwise, auto-confirm:
if ($confirmAccount === false) {
Preferences::setForUser($user, 'user_confirmed', true);
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
Preferences::mark();
return;
}

View File

@ -42,9 +42,12 @@ class IsConfirmed
return redirect()->guest('login');
}
} else {
// must the user be confirmed in the first place?
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
// user must be logged in, then continue:
$isConfirmed = Preferences::get('user_confirmed', false)->data;
if ($isConfirmed === false) {
if ($isConfirmed === false && $confirmAccount === true) {
// user account is not confirmed, redirect to
// confirmation page:

View File

@ -42,9 +42,11 @@ class IsNotConfirmed
return redirect()->guest('login');
}
} else {
// must the user be confirmed in the first place?
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
// user must be logged in, then continue:
$isConfirmed = Preferences::get('user_confirmed', false)->data;
if ($isConfirmed) {
if ($isConfirmed || $confirmAccount === false) {
// user account is confirmed, simply send them home.
return redirect(route('home'));
}