Ver código fonte

Login: Restore authentication failed message.

fusionate 2 anos atrás
pai
commit
9e3d12f587

+ 27 - 2
core/authentication/app_languages.php

@@ -97,7 +97,6 @@ $text['description-totp']['pt-br'] = "Escaneie o código com um aplicativo de au
 $text['description-totp']['pt-pt'] = "Escaneie o código com um aplicativo de autenticação ou gerenciador de senhas. Em seguida, use-o para gerar o token para o login.";
 $text['description-totp']['ro-ro'] = "Scanați codul cu o aplicație de autentificare sau un manager de parole. Apoi utilizați-l pentru a genera simbolul pentru autentificare.";
 $text['description-totp']['ru-ru'] = "Отсканируйте код с помощью приложения для аутентификации или менеджера паролей. Затем используйте его для создания токена для входа в систему.";
-
 $text['description-totp']['sv-se'] = "Skanna koden med en autentiseringsapplikation eller lösenordshanterare. Använd sedan den för att generera token för inloggningen.";
 $text['description-totp']['uk-ua'] = "Відскануйте код за допомогою програми автентифікації або менеджера паролів. Потім використовуйте його, щоб створити маркер для входу.";
 $text['description-totp']['tr-tr'] = "Kodu bir kimlik doğrulama uygulaması veya parola yöneticisi ile tarayın. Ardından, oturum açma için belirteci oluşturmak için kullanın.";
@@ -105,4 +104,30 @@ $text['description-totp']['zh-cn'] = "载有认证申请或密码管理员的编
 $text['description-totp']['ja-jp'] = "認証アプリケーションまたはパスワードマネージャでコードをスキャンします。 ログイン時にトークンを生成します。";
 $text['description-totp']['ko-kr'] = "인증 신청서 또는 비밀번호 관리자로 코드를 스캔합니다. 그런 다음 로그인 토큰을 생성합니다.";
 
-?>
+$text['message-authentication_failed']['en-us'] = "Authentication Failed";
+$text['message-authentication_failed']['en-gb'] = "Authentication Failed";
+$text['message-authentication_failed']['ar-eg'] = "";
+$text['message-authentication_failed']['de-at'] = "";
+$text['message-authentication_failed']['de-ch'] = "";
+$text['message-authentication_failed']['de-de'] = "";
+$text['message-authentication_failed']['el-gr'] = "";
+$text['message-authentication_failed']['es-cl'] = "";
+$text['message-authentication_failed']['es-mx'] = "";
+$text['message-authentication_failed']['fr-ca'] = "";
+$text['message-authentication_failed']['fr-fr'] = "";
+$text['message-authentication_failed']['he-il'] = "";
+$text['message-authentication_failed']['it-it'] = "";
+$text['message-authentication_failed']['nl-nl'] = "";
+$text['message-authentication_failed']['pl-pl'] = "";
+$text['message-authentication_failed']['pt-br'] = "";
+$text['message-authentication_failed']['pt-pt'] = "";
+$text['message-authentication_failed']['ro-ro'] = "";
+$text['message-authentication_failed']['ru-ru'] = "";
+$text['message-authentication_failed']['sv-se'] = "";
+$text['message-authentication_failed']['uk-ua'] = "";
+$text['message-authentication_failed']['tr-tr'] = "";
+$text['message-authentication_failed']['zh-cn'] = "";
+$text['message-authentication_failed']['ja-jp'] = "";
+$text['message-authentication_failed']['ko-kr'] = "";
+
+?>

+ 1 - 1
core/authentication/resources/classes/authentication.php

@@ -53,7 +53,7 @@ class authentication {
 			foreach ($_SESSION['authentication']['methods'] as $name) {
 
 				//already processed the plugin move to the next plugin
-				if ($_SESSION['authentication']['plugin'][$name]['authorized']) {
+				if (!empty($_SESSION['authentication']['plugin']) && $_SESSION['authentication']['plugin'][$name]['authorized']) {
 					continue;
 				}
 

+ 5 - 0
core/authentication/resources/classes/plugins/database.php

@@ -32,6 +32,7 @@ class plugin_database {
 			$settings['theme']['logo'] = !empty($_SESSION['theme']['logo']['text']) ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH.'/themes/default/images/logo_login.png';
 			$settings['theme']['login_logo_width'] = !empty($_SESSION['theme']['login_logo_width']['text']) ? $_SESSION['theme']['login_logo_width']['text'] : 'auto; max-width: 300px';
 			$settings['theme']['login_logo_height'] = !empty($_SESSION['theme']['login_logo_height']['text']) ? $_SESSION['theme']['login_logo_height']['text'] : 'auto; max-height: 300px';
+			$settings['theme']['message_delay'] = isset($_SESSION['theme']['message_delay']) ? 1000 * (float) $_SESSION['theme']['message_delay'] : 3000;
 
 		//already authorized
 			if (isset($_SESSION['authentication']['plugin']['database']) && $_SESSION['authentication']['plugin']['database']["authorized"]) {
@@ -81,6 +82,10 @@ class plugin_database {
 					$view->assign("login_logo_width", $settings['theme']['login_logo_width']);
 					$view->assign("login_logo_height", $settings['theme']['login_logo_height']);
 					$view->assign("login_logo_source", $settings['theme']['logo']);
+					$view->assign("message_delay", $settings['theme']['message_delay']);
+
+				//messages
+					$view->assign('messages', message::html(true, '		'));
 
 				//add the token name and hash to the view
 					//$view->assign("token_name", $token['name']);

+ 50 - 0
core/authentication/resources/views/login.htm

@@ -7,10 +7,60 @@
 		<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
 		<link rel='stylesheet' type='text/css' href='{$project_path}/themes/default/css.php' />
 		<link rel='icon' href='{$favicon}'>
+		<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.min.js.php'></script>
+		<script language='JavaScript' type='text/javascript'>
+
+			//message bar display
+			{literal}
+			function display_message(msg, mood, delay) {
+				mood = mood !== undefined ? mood : 'default';
+				delay = delay !== undefined ? delay : {/literal}{$message_delay}{literal};
+				if (msg !== '') {
+					var message_text = $(document.createElement('div'));
+					message_text.addClass('message_text message_mood_'+mood);
+					message_text.html(msg);
+					message_text.on('click', function() {
+						var object = $(this);
+						object.clearQueue().finish();
+						$('#message_container div').remove();
+						$('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
+					} );
+					$('#message_container').append(message_text);
+					message_text.css({'height': 'auto'}).animate({opacity: 1}, 250, function(){
+						$('#message_container').delay(delay).animate({opacity: 0, 'height': 0}, 500, function() {
+							$('#message_container div').remove();
+							$('#message_container').animate({opacity: 1}, 300).css({'height': 'auto'});
+						});
+					});
+				}
+			}
+			{/literal}
+
+			{literal}
+			$(document).ready(function() {
+				{/literal}
+
+				{$messages}
+
+				//message bar hide on hover
+					{literal}
+					$('#message_container').on('mouseenter',function() {
+						$('#message_container div').remove();
+						$('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
+					});
+					{/literal}
+
+			{literal}
+			}); //document ready end
+			{/literal}
+
+		</script>
+
 		<title>{$login_title}</title>
 	</head>
 	<body>
 		<div id='page' align='center'>
+			<div id='message_container'></div>
 			<div id='default_login'>
 				<a href='{$project_path}/'><img id='login_logo' style='width: {$login_logo_width}; height: {$login_logo_height};' src='{$login_logo_source}' /></a><br />
 				<form method='post' name='frm' action='{$login_destination_url}'>

+ 0 - 26
resources/app_languages.php

@@ -286,32 +286,6 @@ $text['message-toggle']['zh-cn'] = "切换完成";
 $text['message-toggle']['ja-jp'] = "切り替えが完了しました";
 $text['message-toggle']['ko-kr'] = "토글 완료됨";
 
-$text['message-invalid_credentials']['en-us'] = "Invalid Username and/or Password";
-$text['message-invalid_credentials']['en-gb'] = "Invalid Username and/or Password";
-$text['message-invalid_credentials']['ar-eg'] = "اسم المستخدم و / أو كلمة المرور غير صالحة";
-$text['message-invalid_credentials']['de-at'] = "Ungültiger Benutzername und/oder Passwort";
-$text['message-invalid_credentials']['de-ch'] = "Ungültiger Benutzername und/oder Passwort";
-$text['message-invalid_credentials']['de-de'] = "Ungültiger Benutzername und/oder Passwort";
-$text['message-invalid_credentials']['el-gr'] = "Λάθος στοιχεία εισόδου";
-$text['message-invalid_credentials']['es-cl'] = "Nombre de usuario y / o contraseña inválido";
-$text['message-invalid_credentials']['es-mx'] = "Nombre de usuario y / o contraseña inválido";
-$text['message-invalid_credentials']['fr-ca'] = "Nom d'utilisateur et / ou mot de passe incorrect";
-$text['message-invalid_credentials']['fr-fr'] = "Nom d'utilisateur et / ou mot de passe incorrect";
-$text['message-invalid_credentials']['he-il'] = "שם משתמש ו/או סיסמה לא חוקיים";
-$text['message-invalid_credentials']['it-it'] = "Username e / o password non validi";
-$text['message-invalid_credentials']['nl-nl'] = "Ongeldige gebruikersnaam en / of wachtwoord";
-$text['message-invalid_credentials']['pl-pl'] = "Niepoprawna nazwa użytkownika i/lub hasło";
-$text['message-invalid_credentials']['pt-br'] = "Nome de usuário e/ou senha inválida";
-$text['message-invalid_credentials']['pt-pt'] = "Nome de usuário e/ou senha inválidos";
-$text['message-invalid_credentials']['ro-ro'] = "Nume de utilizator și / sau parolă nevalide";
-$text['message-invalid_credentials']['ru-ru'] = "Неверное имя пользователя или пароль";
-$text['message-invalid_credentials']['sv-se'] = "Ogiltigt användarnamn och / eller lösenord";
-$text['message-invalid_credentials']['uk-ua'] = "Недійсне ім'я користувача та/або пароль";
-$text['message-invalid_credentials']['tr-tr'] = "Geçersiz Kullanıcı Adı ve/veya Parola";
-$text['message-invalid_credentials']['zh-cn'] = "无效用户名称和/或密码";
-$text['message-invalid_credentials']['ja-jp'] = "無効なユーザー名とパスワード";
-$text['message-invalid_credentials']['ko-kr'] = "잘못된 Username 및/또는 Password";
-
 $text['message-invalid_token']['en-us'] = "Invalid Token";
 $text['message-invalid_token']['en-gb'] = "Invalid Token";
 $text['message-invalid_token']['ar-eg'] = "غير صحيح";

+ 1 - 1
resources/check_auth.php

@@ -67,7 +67,7 @@
 
 				//redirect the user to the login page
 					$target_path = ($_REQUEST["path"] != '') ? $_REQUEST["path"] : $_SERVER["PHP_SELF"];
-					message::add($text['message-invalid_credentials'], 'negative');
+					message::add($text['message-authentication_failed'], 'negative');
 					header("Location: ".PROJECT_PATH."/?path=".urlencode($target_path));
 					exit;
 			}