summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-18 16:08:33 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-18 16:08:33 +0100
commit112ec25e5a2126578b670921614ab2857e473adb (patch)
treeb41550a04033298c68e7baeb9423e0f105d10510
parent0bd77f137dfcdcec2d9fd14926c5c85961c2b23a (diff)
Translate and improve "login failed" message
-rw-r--r--css/codeq.css5
-rw-r--r--index.html1
-rw-r--r--js/codeq/login.js14
-rw-r--r--res/en.json1
-rw-r--r--res/sl.json1
5 files changed, 13 insertions, 9 deletions
diff --git a/css/codeq.css b/css/codeq.css
index 881f46d..667349e 100644
--- a/css/codeq.css
+++ b/css/codeq.css
@@ -110,6 +110,10 @@ button.navbar-toggle > span.glyphicon {
padding: 15px 0;
}
+#screen_login div.login-failed {
+ color: red;
+}
+
/* screen language */
#screen_language {
margin-top: 20px;
@@ -124,7 +128,6 @@ button.navbar-toggle > span.glyphicon {
}
/* screen about*/
-
.about-logos {
text-align: center;
height: 6em;
diff --git a/index.html b/index.html
index 4cac786..5d9949e 100644
--- a/index.html
+++ b/index.html
@@ -131,6 +131,7 @@
<input type="checkbox"> keep me logged-in
</label>
</div-->
+ <div class="login-failed" data-tkey="login_failed" style="display: none;">Login failed.</div>
</form>
</div>
<div class="panel-footer"><!-- class="modal-footer"-->
diff --git a/js/codeq/login.js b/js/codeq/login.js
index 79371be..5f6aa4c 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -28,12 +28,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
jqSignupBtn = $('#signup_button'),
jqSubmitLoginBtn = $("#submit"),
jqLangSelect = jqScreen.find('.lang-select'),
- jqDisabledOverlay = $('#disabled');
+ jqDisabledOverlay = $('#disabled'),
+ jqLoginFailed = jqScreen.find('.login-failed');
//the loginCallbackFunction is used here and in the AAI login as well
codeq.loginCallbackFunction = function (data) {
jqDisabledOverlay.css('display', 'none');
- jqDisabledOverlay.css('cursor', '');
if (data.code !== 0) throw new Error('Login failed, code: ' + data.code + ', message: ' + data.message);
//nav signed in...
@@ -62,18 +62,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
};
var loginFun = function(){
- jqDisabledOverlay.css('display', '');
- jqDisabledOverlay.css('cursor', 'wait');
+ jqLoginFailed.hide();
codeq.comms.connect()
.then(function () {
return codeq.comms.login($('#username').val(), $('#password').val());
})
.then(codeq.loginCallbackFunction)
.fail(function (reason) {
- jqDisabledOverlay.css('display', 'none');
- jqDisabledOverlay.css('cursor', '');
- codeq.log.error('Login failed: ' + reason);
- alert('Login request failed: ' + reason);
+ jqLoginFailed.show();
})
.done();
},
@@ -85,6 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
'enter': function(){
jqNavigationHomeBtn.off('click');//remove the click listener of this element here
jqNavBarRight.css('display','none');//hide settings etc.
+ jqLoginFailed.hide();
$('#signed-in-title').html('');
codeq.samlLogin = false;//remove saml login flag
@@ -132,6 +129,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
e.preventDefault();
});
jqNavBarRight.css('display','');
+ jqLoginFailed.hide();
}
});
})();
diff --git a/res/en.json b/res/en.json
index d952180..a4731ed 100644
--- a/res/en.json
+++ b/res/en.json
@@ -27,6 +27,7 @@
"signin_via": "Login via",
"signin_or": "or",
"signin_button": "Sign in",
+ "login_failed": "Login failed.",
"signin_footer": "New here?",
"signin_footer_signup": "Sign up!",
"username": "Username",
diff --git a/res/sl.json b/res/sl.json
index d1479b6..2743647 100644
--- a/res/sl.json
+++ b/res/sl.json
@@ -27,6 +27,7 @@
"signin_via": "Prijava prek",
"signin_or": "ali",
"signin_button": "Prijavi se",
+ "login_failed": "Prijava ni uspela.",
"signin_footer": "Nov tukaj?",
"signin_footer_signup": "Registriraj se!",
"username": "Uporabniško ime",