Move isUserVerified to OC_Util
This commit is contained in:
parent
77e18b01ba
commit
f4142bd2a8
13
lib/json.php
13
lib/json.php
|
@ -90,18 +90,7 @@ class OC_JSON{
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Check if the user verified the login with his password in the last 15 minutes
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function isUserVerified() {
|
|
||||||
// Check if the user verified his password in the last 15 minutes
|
|
||||||
if(!isset($_SESSION['verifiedLogin']) OR $_SESSION['verifiedLogin'] < time()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send json error msg
|
* Send json error msg
|
||||||
*/
|
*/
|
||||||
|
|
12
lib/util.php
12
lib/util.php
|
@ -405,6 +405,18 @@ class OC_Util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the user verified the login with his password in the last 15 minutes
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isUserVerified() {
|
||||||
|
// Check if the user verified his password in the last 15 minutes
|
||||||
|
if(!isset($_SESSION['verifiedLogin']) OR $_SESSION['verifiedLogin'] < time()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to the user default page
|
* Redirect to the user default page
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ if(OC_User::getUser() === $username) {
|
||||||
{
|
{
|
||||||
$userstatus = 'user';
|
$userstatus = 'user';
|
||||||
} else {
|
} else {
|
||||||
if (!OC_JSON::isUserVerified()) {
|
if (!OC_Util::isUserVerified()) {
|
||||||
$userstatus = null;
|
$userstatus = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue