activation class static changes
This commit is contained in:
parent
dd4cd6d6ae
commit
81f2b2dbb9
|
|
@ -10,7 +10,7 @@ namespace Alphaland\Users {
|
|||
|
||||
class Activation
|
||||
{
|
||||
private function generateActivationCode()
|
||||
private static function generateActivationCode()
|
||||
{
|
||||
$hash = "";
|
||||
while (true) {
|
||||
|
|
@ -26,7 +26,7 @@ namespace Alphaland\Users {
|
|||
return $hash;
|
||||
}
|
||||
|
||||
public function getUserActivationCode(int $userid)
|
||||
public static function getUserActivationCode(int $userid)
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `alphaland_verification` WHERE `uid` = :uid");
|
||||
$query->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||
|
|
@ -37,7 +37,7 @@ namespace Alphaland\Users {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function isUserActivated(int $userid)
|
||||
public static function isUserActivated(int $userid)
|
||||
{
|
||||
$query = $GLOBALS['pdo']->prepare("SELECT * FROM `alphaland_verification` WHERE `isactivated` = 1 AND `uid` = :uid");
|
||||
$query->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||
|
|
@ -46,12 +46,12 @@ namespace Alphaland\Users {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setupUserActivation(int $userid) //this should be ran when the user first signs up
|
||||
public static function setupUserActivation(int $userid) //this should be ran when the user first signs up
|
||||
{
|
||||
if (!$this->isUserActivated($userid)) {
|
||||
$activationcode = $this->generateActivationCode();
|
||||
if (!Activation::isUserActivated($userid)) {
|
||||
$activationcode = Activation::generateActivationCode();
|
||||
|
||||
$n = $GLOBALS['pdo']->prepare("INSERT INTO `alphaland_verification`(`activationcode`,`uid`) VALUES(:ac, :userid)");
|
||||
$n->bindParam(":ac", $activationcode, PDO::PARAM_STR);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ try
|
|||
}
|
||||
|
||||
$activated = new Alphaland\Users\Activation();
|
||||
$activated = $activated->isUserActivated($GLOBALS['user']->id);
|
||||
$activated = $activated::isUserActivated($GLOBALS['user']->id);
|
||||
$maintenance = checkIfUnderMaintenance();
|
||||
$banned = checkIfBanned($GLOBALS['user']->id);
|
||||
$twofactor = isSession2FAUnlocked();
|
||||
|
|
@ -183,8 +183,7 @@ try
|
|||
}
|
||||
}
|
||||
else if ($accesseddomain == "api.".$domain) { //api
|
||||
if ($accesseddirectory != "/logo.php" &&
|
||||
$accesseddirectory != "/moderation/v2/filtertext.php") {
|
||||
if ($accesseddirectory != "/logo.php") {
|
||||
redirect($url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class user {
|
|||
|
||||
//activation stuff
|
||||
$activated = new Alphaland\Users\Activation();
|
||||
$activated = $activated->isUserActivated($this->id);
|
||||
$activated = $activated::isUserActivated($this->id);
|
||||
|
||||
if (!banned($this->id))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
$activation = new Alphaland\Users\Activation();
|
||||
|
||||
if ($activation->isUserActivated($user->id)) {
|
||||
if ($activation::isUserActivated($user->id)) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
$activationcode = $activation->getUserActivationCode($user->id);
|
||||
$activationcode = $activation::getUserActivationCode($user->id);
|
||||
|
||||
$body = '
|
||||
<div class="container-fluid" style="display: flex;justify-content: center;align-items: center;text-align: center;min-height: 100vh;">
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ else
|
|||
|
||||
//setup the activation system
|
||||
$activation = new Alphaland\Users\Activation();
|
||||
$activation->setupUserActivation($userID);
|
||||
$activation::setupUserActivation($userID);
|
||||
|
||||
//create new session
|
||||
createSession($userID);
|
||||
|
|
|
|||
Loading…
Reference in New Issue