Commit 608c8af2 authored by Nigel McNie's avatar Nigel McNie
Browse files

Ensure that when a user is deleted, suspended or has their account expired,...

Ensure that when a user is deleted, suspended or has their account expired, they really are unable to log in.

Not sure for how long this has been broken, but it seems that deleted users could browse around the site just fine. They don't show up in search results but you can still view their profile page...
parent e9a5ab75
......@@ -978,11 +978,13 @@ function login_submit(Pieform $form, $values) {
// Check if the user's account has been deleted
if ($USER->deleted) {
$USER->logout();
die_info(get_string('accountdeleted'));
}
// Check if the user's account has expired
if ($USER->expiry > 0 && time() > $USER->expiry) {
$USER->logout();
die_info(get_string('accountexpired'));
}
......@@ -990,12 +992,16 @@ function login_submit(Pieform $form, $values) {
$inactivetime = get_field('institution', 'defaultaccountinactiveexpire', 'name', $USER->institution);
if ($inactivetime && $oldlastlogin > 0
&& $oldlastlogin + $inactivetime < time()) {
$USER->logout();
die_info(get_string('accountinactive'));
}
// Check if the user's account has been suspended
if ($USER->suspendedcusr) {
die_info(get_string('accountsuspended', 'mahara', $USER->suspendedctime, $USER->suspendedreason));
$suspendedctime = $USER->suspendedctime;
$suspendedreason = $USER->suspendedreason;
$USER->logout();
die_info(get_string('accountsuspended', 'mahara', $suspendedctime, $suspendedreason));
}
// User is allowed to log in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment