Browse Source

Bugfix: userinfo box can now correctly displayed abter login/logout

feature/jQueryMainPage
LO Kam Tao Leo 4 years ago
parent
commit
a7145b9f19
  1. 9
      WebContent/index.jsp

9
WebContent/index.jsp

@ -14,13 +14,13 @@
if(data.identified){ if(data.identified){
//Handle userinfo box and logout link //Handle userinfo box and logout link
$("#hdr-action").text("Welcome back, "+data.username); $("#hdr-action").text("Welcome back, "+data.username);
$("#hdr-action").click(function(){ $("#hdr-action").off('click').on('click',function(){
$("#hdr-uinfo").toggle(); $("#hdr-uinfo").toggle();
}); });
}else{ }else{
//Display login link //Display login link
$("#hdr-action").text("Login"); $("#hdr-action").text("Login");
$("#hdr-action").click(function(){ $("#hdr-action").off('click').on('click',function(){
$("#hdr-login").toggle(); $("#hdr-login").toggle();
}); });
} }
@ -66,8 +66,6 @@
$("#hdr-login-submit").click(function(){ $("#hdr-login-submit").click(function(){
var uname = $("#hdr-login-username").val(); var uname = $("#hdr-login-username").val();
var pass = $("#hdr-login-password").val(); var pass = $("#hdr-login-password").val();
console.log("uname="+uname);
console.log("paswd="+pass);
if(uname==null || pass==null || uname=="" ||pass==""){ if(uname==null || pass==null || uname=="" ||pass==""){
//Display error message //Display error message
$("#hdr-login-msg-cont").text("Username and password are required."); $("#hdr-login-msg-cont").text("Username and password are required.");
@ -80,10 +78,13 @@
if(data.status=="failed"){ if(data.status=="failed"){
$("#hdr-login-msg-cont").text(data.message); $("#hdr-login-msg-cont").text(data.message);
$("#hdr-login-msg").show(); $("#hdr-login-msg").show();
$("#hdr-login-password").val("");
}else{ }else{
updateUserInfo(); updateUserInfo();
$("#hdr-login-msg").hide(); $("#hdr-login-msg").hide();
$("#hdr-login").hide(); $("#hdr-login").hide();
$("#hdr-login-username").val("");
$("#hdr-login-password").val("");
} }
}) })
}); });

Loading…
Cancel
Save