Skip to content

Commit d09d7bc

Browse files
committed
Fixes #510
1 parent f53b581 commit d09d7bc

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

userfrosting/locale/en_US.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"ACCOUNT_REGISTRATION_BROKEN" => "We're sorry, there is a problem with our account registration process. Please contact us directly for assistance.",
5353
"ACCOUNT_REGISTRATION_LOGOUT" => "I'm sorry, you cannot register for an account while logged in. Please log out first.",
5454
"ACCOUNT_INACTIVE" => "Your account is in-active. Check your emails / spam folder for account activation instructions.",
55-
"ACCOUNT_DISABLED" => "This account has been disabled. Please contact us for more information.",
55+
"ACCOUNT_INVALID" => "This account does not exist. It may have been deleted. Please contact us for more information.",
56+
"ACCOUNT_DISABLED" => "This account has been disabled. Please contact us for more information.",
5657
"ACCOUNT_USER_CHAR_LIMIT" => "Your username must be between {{min}} and {{max}} characters in length.",
5758
"ACCOUNT_USER_INVALID_CHARACTERS" => "Username can only include alpha-numeric characters",
5859
"ACCOUNT_USER_NO_LEAD_WS" => "Username cannot begin with whitespace",

userfrosting/models/UserFrosting.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,24 @@ public function setupErrorHandling(){
7979
return $this->logout(true);
8080
}
8181

82+
if ($e instanceof AccountDisabledException) {
83+
$this->logout(false);
84+
// Create a new session to store alerts
85+
$this->startSession();
86+
// Seems to be needed to create a new session as per http://stackoverflow.com/questions/19738422/destroying-old-session-making-new-but-php-still-refers-to-old-session
87+
session_regenerate_id(true);
88+
$this->setupServices($this->site->default_locale);
89+
$this->alerts->addMessageTranslated('danger','ACCOUNT_DISABLED');
90+
$this->redirect($this->urlFor('uri_home'));
91+
}
92+
8293
if ($e instanceof AccountInvalidException) {
83-
$controller = new AccountController($this);
84-
return $this->logout(false);
94+
$this->logout(false);
95+
$this->startSession();
96+
session_regenerate_id(true);
97+
$this->setupServices($this->site->default_locale);
98+
$this->alerts->addMessageTranslated('danger','ACCOUNT_INVALID');
99+
$this->redirect($this->urlFor('uri_home'));
85100
}
86101

87102
if ($e instanceof AuthCompromisedException) {

0 commit comments

Comments
 (0)