mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-17 11:28:41 +01:00
auth.php: passthrough the context
This commit is contained in:
parent
13ca053e06
commit
e6133ef00f
@ -4,6 +4,7 @@
|
|||||||
* Copyright (c) 2010-2013 Tinyboard Development Group
|
* Copyright (c) 2010-2013 Tinyboard Development Group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Vichan\Context;
|
||||||
use Vichan\Functions\Net;
|
use Vichan\Functions\Net;
|
||||||
|
|
||||||
defined('TINYBOARD') or exit;
|
defined('TINYBOARD') or exit;
|
||||||
@ -232,7 +233,7 @@ function make_secure_link_token(string $uri): string {
|
|||||||
return substr(sha1($config['cookies']['salt'] . '-' . $uri . '-' . $mod['id']), 0, 8);
|
return substr(sha1($config['cookies']['salt'] . '-' . $uri . '-' . $mod['id']), 0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_login(bool $prompt = false): void {
|
function check_login(Context $ctx, bool $prompt = false): void {
|
||||||
global $config, $mod;
|
global $config, $mod;
|
||||||
|
|
||||||
$is_https = Net\is_connection_secure($config['cookies']['secure_login_only'] === 1);
|
$is_https = Net\is_connection_secure($config['cookies']['secure_login_only'] === 1);
|
||||||
@ -246,7 +247,9 @@ function check_login(bool $prompt = false): void {
|
|||||||
if (count($cookie) != 3) {
|
if (count($cookie) != 3) {
|
||||||
// Malformed cookies
|
// Malformed cookies
|
||||||
destroyCookies();
|
destroyCookies();
|
||||||
if ($prompt) mod_login();
|
if ($prompt) {
|
||||||
|
mod_login($ctx);
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +262,9 @@ function check_login(bool $prompt = false): void {
|
|||||||
if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) {
|
if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) {
|
||||||
// Malformed cookies
|
// Malformed cookies
|
||||||
destroyCookies();
|
destroyCookies();
|
||||||
if ($prompt) mod_login();
|
if ($prompt) {
|
||||||
|
mod_login($ctx);
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user