emiting a notice from include/auth does not work. emit it from mod login if the login failed.

This commit is contained in:
Mario Vavti
2025-06-25 17:33:35 +02:00
parent d636e71024
commit 2aeed27b9b
3 changed files with 12 additions and 7 deletions

View File

@@ -5,10 +5,17 @@ namespace Zotlabs\Module;
class Login extends \Zotlabs\Web\Controller { class Login extends \Zotlabs\Web\Controller {
function get() { function get() {
if(local_channel()) if (local_channel()) {
goaway(z_root()); goaway(z_root());
if(remote_channel() && $_SESSION['atoken']) }
if (remote_channel() && $_SESSION['atoken']) {
goaway(z_root()); goaway(z_root());
}
if (!empty($_GET['retry'])) {
notice( t('Login failed.') . EOL );
}
$o = '<div class="generic-content-wrapper">'; $o = '<div class="generic-content-wrapper">';
$o .= '<div class="section-title-wrapper">'; $o .= '<div class="section-title-wrapper">';

View File

@@ -353,9 +353,6 @@ else {
elseif($atoken) { elseif($atoken) {
atoken_login($atoken); atoken_login($atoken);
} }
else {
notice( t('Failed authentication') . EOL);
}
if(! ($account || $atoken)) { if(! ($account || $atoken)) {
$error = 'authenticate: failed login attempt: ' . notags(trim($username)) . ' from IP ' . $_SERVER['REMOTE_ADDR']; $error = 'authenticate: failed login attempt: ' . notags(trim($username)) . ' from IP ' . $_SERVER['REMOTE_ADDR'];
@@ -364,8 +361,8 @@ else {
$authlog = Config::Get('system', 'authlog'); $authlog = Config::Get('system', 'authlog');
if ($authlog) if ($authlog)
@file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $error . "\n", FILE_APPEND); @file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $error . "\n", FILE_APPEND);
notice( t('Login failed.') . EOL );
goaway(z_root() . '/login'); goaway(z_root() . '/login?retry=1');
} }
// If the user specified to remember the authentication, then change the cookie // If the user specified to remember the authentication, then change the cookie

View File

@@ -88,6 +88,7 @@
} }
else { else {
if (!document.hidden) { if (!document.hidden) {
sse_fallback();
sse_fallback_interval = setInterval(sse_fallback, updateInterval); sse_fallback_interval = setInterval(sse_fallback, updateInterval);
} }