Redirect user upon successful login/registration
This commit is contained in:
parent
f85b55e19b
commit
53b4b10947
3 changed files with 10 additions and 6 deletions
|
@ -55,8 +55,8 @@ function display_message(containerId, alertType, message, callback) {
|
|||
$("#" + containerId).hide().slideDown("fast", "swing", function() {
|
||||
window.setTimeout(function () {
|
||||
$("#" + containerId).slideUp("fast", "swing", callback);
|
||||
});
|
||||
}, 2000);
|
||||
}, message.length * 75);
|
||||
});
|
||||
}
|
||||
|
||||
function load_navbar() {
|
||||
|
|
|
@ -10,8 +10,10 @@ function login(email, password) {
|
|||
password: password
|
||||
}, function(data) {
|
||||
if (data.success == 1) {
|
||||
display_message("status", "success", "Success!", function() {$("#login").removeAttr("disabled");});
|
||||
// wait then redirect or whatever
|
||||
display_message("status", "success", "Success!", function() {
|
||||
$("#login").removeAttr("disabled");
|
||||
window.location = "#/account";
|
||||
});
|
||||
} else {
|
||||
display_message("status", "danger", data.message, function() {$("#login").removeAttr("disabled");});
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ function register(name, username, password, password_confirm, email, captcha_res
|
|||
}, function(data) {
|
||||
$("#status").text(data.message);
|
||||
if (data.success == 1) {
|
||||
display_message("status", "success", "Success!", function() {$("#register").removeAttr("disabled")});
|
||||
// wait then redirect or whatever
|
||||
display_message("status", "success", "Success!", function() {
|
||||
$("#register").removeAttr("disabled");
|
||||
window.location = "#/login";
|
||||
});
|
||||
} else {
|
||||
display_message("status", "danger", data.message, function() {$("#register").removeAttr("disabled")});
|
||||
grecaptcha.reset();
|
||||
|
|
Loading…
Reference in a new issue