fixed problem of cookie path
This commit is contained in:
parent
89dcc5675e
commit
917306dbe9
@ -2,7 +2,7 @@
|
|||||||
* @Author: prpr
|
* @Author: prpr
|
||||||
* @Date: 2016-01-21 13:55:44
|
* @Date: 2016-01-21 13:55:44
|
||||||
* @Last Modified by: prpr
|
* @Last Modified by: prpr
|
||||||
* @Last Modified time: 2016-02-02 21:41:26
|
* @Last Modified time: 2016-02-03 10:19:29
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -30,8 +30,8 @@ $("body").on("click", "#login-button", function(){
|
|||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json.errno == 0) {
|
if (json.errno == 0) {
|
||||||
docCookies.setItem("uname", uname, '/');
|
docCookies.setItem("uname", uname, null, '/');
|
||||||
docCookies.setItem("token", json.token, '/');
|
docCookies.setItem("token", json.token, null, '/');
|
||||||
if ($("#keep").prop("checked")) {
|
if ($("#keep").prop("checked")) {
|
||||||
docCookies.setItem("uname", uname, 604800, '/');
|
docCookies.setItem("uname", uname, 604800, '/');
|
||||||
// 设置长效 token (7天)
|
// 设置长效 token (7天)
|
||||||
@ -41,6 +41,7 @@ $("body").on("click", "#login-button", function(){
|
|||||||
window.setTimeout("window.location = './user/index.php'", 1000);
|
window.setTimeout("window.location = './user/index.php'", 1000);
|
||||||
} else {
|
} else {
|
||||||
showAlert(json.msg);
|
showAlert(json.msg);
|
||||||
|
showMsg('hide', "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -66,8 +67,8 @@ $("body").on("click", "#register-button", function(){
|
|||||||
$('[data-remodal-id=register-modal]').remodal().close();
|
$('[data-remodal-id=register-modal]').remodal().close();
|
||||||
showMsg('hide', "");
|
showMsg('hide', "");
|
||||||
} else {
|
} else {
|
||||||
showMsg('hide', "");
|
|
||||||
showAlert(json.msg);
|
showAlert(json.msg);
|
||||||
|
showMsg('hide', "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: prpr
|
* @Author: prpr
|
||||||
* @Date: 2016-01-21 13:56:40
|
* @Date: 2016-01-21 13:56:40
|
||||||
* @Last Modified by: prpr
|
* @Last Modified by: prpr
|
||||||
* @Last Modified time: 2016-01-22 11:23:48
|
* @Last Modified time: 2016-02-03 10:17:30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -77,9 +77,8 @@ $("#logout").click(function(){
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {"uname": docCookies.getItem('uname')},
|
data: {"uname": docCookies.getItem('uname')},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var path = "/" + document.URL.split("/").slice(-3)[0];
|
docCookies.removeItem("uname", "/");
|
||||||
docCookies.removeItem("uname", path);
|
docCookies.removeItem("token", "/");
|
||||||
docCookies.removeItem("token", path);
|
|
||||||
showAlert(json.msg + " Successfully logged out.");
|
showAlert(json.msg + " Successfully logged out.");
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function(){
|
||||||
window.location = "../index.php";
|
window.location = "../index.php";
|
||||||
|
Loading…
Reference in New Issue
Block a user