Test Failed
Push — master ( b9a3fa...4bf7f3 )
by Justin
55:58 queued 51:30
created
system/packages/com.jukusoft.cms.user/classes/mail_verification.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -27,55 +27,55 @@
 block discarded – undo
27 27
 
28 28
 class Mail_Verification {
29 29
 
30
-	public static function sendMail (int $userID, string $username, string $mail) {
31
-		//generate token
32
-		$token = PHPUtils::randomString(64);
30
+    public static function sendMail (int $userID, string $username, string $mail) {
31
+        //generate token
32
+        $token = PHPUtils::randomString(64);
33 33
 
34
-		Database::getInstance()->execute("INSERT INTO `{praefix}register_mail_verification` (
34
+        Database::getInstance()->execute("INSERT INTO `{praefix}register_mail_verification` (
35 35
 			`userID`, `token`
36 36
 		) VALUES (
37 37
 			:userID, :token
38 38
 		) ON DUPLICATE KEY UPDATE `token` = :token; ", array(
39
-			'userID' => $userID,
40
-			'token' => $token
41
-		));
42
-
43
-		//send mail
44
-		$template = new DwooTemplate(STORE_PATH . "templates/mail/verify_mail.tpl");
45
-
46
-		//assign variables
47
-		$template->assign("token", $token);
48
-		$template->assign("userID", $userID);
49
-		$template->assign("username", $username);
50
-		$template->assign("verify_url", DomainUtils::generateURL("user/verify_mail", array('token' => $token, 'username' => $username)));
51
-		$template->assign("base_url", DomainUtils::getBaseURL());
52
-		$template->assign("mail", $mail);
53
-
54
-		$message = $template->getCode();
55
-
56
-		//send mail
57
-		MailApi::sendHTMLMail($mail, "Mail Verification " . Settings::get("website_name", ""), $message);
58
-	}
59
-
60
-	public static function checkToken (string $token) : bool {
61
-		$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}register_mail_verification` WHERE `token` = :token; ", array('token' => $token));
62
-
63
-		if ($row === false) {
64
-			return false;
65
-		} else {
66
-			//activate user
67
-			Database::getInstance()->execute("UPDATE `{praefix}user` SET `activated` = '1' WHERE `userID` = :userID AND `activated` = '2'; ", array('userID' => $row['userID']));
68
-
69
-			//remove token
70
-			self::removeToken($token);
71
-
72
-			return true;
73
-		}
74
-	}
75
-
76
-	public static function removeToken (string $token) {
77
-		Database::getInstance()->execute("DELETE FROM `{praefix}register_mail_verification` WHERE `token` = :token; ", array('token' => $token));
78
-	}
39
+            'userID' => $userID,
40
+            'token' => $token
41
+        ));
42
+
43
+        //send mail
44
+        $template = new DwooTemplate(STORE_PATH . "templates/mail/verify_mail.tpl");
45
+
46
+        //assign variables
47
+        $template->assign("token", $token);
48
+        $template->assign("userID", $userID);
49
+        $template->assign("username", $username);
50
+        $template->assign("verify_url", DomainUtils::generateURL("user/verify_mail", array('token' => $token, 'username' => $username)));
51
+        $template->assign("base_url", DomainUtils::getBaseURL());
52
+        $template->assign("mail", $mail);
53
+
54
+        $message = $template->getCode();
55
+
56
+        //send mail
57
+        MailApi::sendHTMLMail($mail, "Mail Verification " . Settings::get("website_name", ""), $message);
58
+    }
59
+
60
+    public static function checkToken (string $token) : bool {
61
+        $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}register_mail_verification` WHERE `token` = :token; ", array('token' => $token));
62
+
63
+        if ($row === false) {
64
+            return false;
65
+        } else {
66
+            //activate user
67
+            Database::getInstance()->execute("UPDATE `{praefix}user` SET `activated` = '1' WHERE `userID` = :userID AND `activated` = '2'; ", array('userID' => $row['userID']));
68
+
69
+            //remove token
70
+            self::removeToken($token);
71
+
72
+            return true;
73
+        }
74
+    }
75
+
76
+    public static function removeToken (string $token) {
77
+        Database::getInstance()->execute("DELETE FROM `{praefix}register_mail_verification` WHERE `token` = :token; ", array('token' => $token));
78
+    }
79 79
 
80 80
 }
81 81
 
Please login to merge, or discard this patch.