Redirect user upon successful login/registration

This commit is contained in:
James Wang 2016-01-02 14:49:48 -05:00
parent f85b55e19b
commit 53b4b10947
3 changed files with 10 additions and 6 deletions

View file

@ -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() {

View file

@ -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");});
}

View file

@ -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();