mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
login update user lang
This commit is contained in:
@@ -6,12 +6,13 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
|||||||
|
|
||||||
class VerifyCsrfToken extends Middleware
|
class VerifyCsrfToken extends Middleware
|
||||||
{
|
{
|
||||||
|
const TG_WEBHOOK_PREFIX = "tg-webhook";
|
||||||
/**
|
/**
|
||||||
* The URIs that should be excluded from CSRF verification.
|
* The URIs that should be excluded from CSRF verification.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
self::TG_WEBHOOK_PREFIX . "/*"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.11');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.12');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-03-27');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-04-01');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
@@ -470,20 +470,26 @@ function arr_set(&$array, $key, $value)
|
|||||||
|
|
||||||
function isHttps(): bool
|
function isHttps(): bool
|
||||||
{
|
{
|
||||||
$schema = nexus()->getRequestSchema();
|
if (isRunningInConsole()) {
|
||||||
return $schema == 'https';
|
$securityLogin = get_setting("security.securelogin");
|
||||||
|
if ($securityLogin != "no") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return nexus()->getRequestSchema() == 'https';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getSchemeAndHttpHost()
|
function getSchemeAndHttpHost(bool $fromConfig = false)
|
||||||
{
|
{
|
||||||
global $BASEURL;
|
if (isRunningInConsole() || $fromConfig) {
|
||||||
if (isRunningInConsole()) {
|
$host = get_setting("basic.BASEURL");
|
||||||
return $BASEURL;
|
} else {
|
||||||
|
$host = nexus()->getRequestHost();
|
||||||
}
|
}
|
||||||
$isHttps = isHttps();
|
$isHttps = isHttps();
|
||||||
$protocol = $isHttps ? 'https' : 'http';
|
$protocol = $isHttps ? 'https' : 'http';
|
||||||
$host = nexus()->getRequestHost();
|
|
||||||
return "$protocol://" . $host;
|
return "$protocol://" . $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function bark($text = "")
|
|||||||
}
|
}
|
||||||
if ($iv == "yes")
|
if ($iv == "yes")
|
||||||
check_code ($_POST['imagehash'], $_POST['imagestring'],'login.php',true);
|
check_code ($_POST['imagehash'], $_POST['imagestring'],'login.php',true);
|
||||||
$res = sql_query("SELECT id, passhash, secret, enabled, status, two_step_secret FROM users WHERE username = " . sqlesc($username));
|
$res = sql_query("SELECT id, passhash, secret, enabled, status, two_step_secret, lang FROM users WHERE username = " . sqlesc($username));
|
||||||
$row = mysql_fetch_array($res);
|
$row = mysql_fetch_array($res);
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
@@ -83,6 +83,14 @@ else
|
|||||||
|
|
||||||
do_log($log);
|
do_log($log);
|
||||||
|
|
||||||
|
//update user lang
|
||||||
|
$language = \App\Models\Language::query()->where("site_lang_folder", get_langfolder_cookie())->first();
|
||||||
|
if ($language && $language->id != $row["lang"]) {
|
||||||
|
do_log(sprintf("update user: %s lang: %s => %s", $row["id"], $row["lang"], $language->id));
|
||||||
|
\App\Models\User::query()->where("id", $row["id"])->update(["lang" => $language->id]);
|
||||||
|
clear_user_cache($row["id"]);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST["logout"]) && $_POST["logout"] == "yes")
|
if (isset($_POST["logout"]) && $_POST["logout"] == "yes")
|
||||||
{
|
{
|
||||||
logincookie($row["id"], $passh,1,900,$securelogin_indentity_cookie, $ssl, $trackerssl);
|
logincookie($row["id"], $passh,1,900,$securelogin_indentity_cookie, $ssl, $trackerssl);
|
||||||
|
|||||||
Reference in New Issue
Block a user