Skip to content
Snippets Groups Projects
Commit 4ad4d81f authored by Ye Tian's avatar Ye Tian
Browse files

logout after successfully changed password

parent 206d242e
Branches
No related tags found
No related merge requests found
......@@ -69,27 +69,23 @@ function submitEditForm() {
//退出登录
// quitLoginClick();
$.confirm({
title : '',
content : 'Succeffully Modify the Password !',
autoClose : 'ok|3000',
type : 'green',
buttons : {
ok : {
text : 'Yes',
btnClass : 'btn-primary',
keys : [ 'enter', 'a' ],
action : function() {
//点击登录
$('#loginBtn').click();
}
$.ajax({
type: 'post',
url: 'LoginServlet',
data: {
"type": "logout"
},
cancel : {
text : 'No',
btnClass : 'btn-primary',
keys : [ 'ESC' ],
dataType: 'text',
success: function(data){
if(data == "logout"){
window.location.href="index.html";
} else{
alert("no user now");
}
},
error : function(msg) {
alert("logout failed");
console.log(msg)
}
});
}else{
......
......@@ -184,26 +184,6 @@ function confirmToLogin(){
});
}
// function checkLoginState(){
// var strcookie = document.cookie;
// if(strcookie==null || strcookie.length==0){
// //alert("no login");
// $("#loginbtn").show();
// $("#logout").hide();
// //$("#toHomepage").hide();
// document.getElementById("toHomepage").style.display="none";
// } else{
// var userPhotoStr = strcookie.split(";")[1];
// var userPhoto = userPhotoStr.split("=")[1];
// if(userPhoto=="null") userPhoto="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3439779931,834673929&fm=26&gp=0.jpg";
// $("#loginbtn").hide();
// $("#logout").show();
// //$("#toHomepage").show();
// document.getElementById("myPhoto").src = userPhoto;
// document.getElementById("toHomepage").style.display="inline";
// }
// }
function openHomepage(){
window.location.href="person.html";
}
......@@ -228,29 +208,6 @@ function logout(){
}
}
});
// if(confirm("Sure to logout?")){
// $.ajax({
// type: 'post',
// url: 'LoginServlet',
// data: {
// "type": "logout"
// },
// dataType: 'text',
// success: function(data){
// if(data == "logout"){
// //window.location.href="register.jsp";
// window.location.href="index.html";
// } else{
// alert("no user now");
// }
// },
// error : function(msg) {
// alert("logout failed");
// console.log(msg)
// }
// });
// }
}
//Logout without confirm
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment