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() {
|
$("#" + containerId).hide().slideDown("fast", "swing", function() {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
$("#" + containerId).slideUp("fast", "swing", callback);
|
$("#" + containerId).slideUp("fast", "swing", callback);
|
||||||
|
}, message.length * 75);
|
||||||
});
|
});
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_navbar() {
|
function load_navbar() {
|
||||||
|
|
|
@ -10,8 +10,10 @@ function login(email, password) {
|
||||||
password: password
|
password: password
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
if (data.success == 1) {
|
if (data.success == 1) {
|
||||||
display_message("status", "success", "Success!", function() {$("#login").removeAttr("disabled");});
|
display_message("status", "success", "Success!", function() {
|
||||||
// wait then redirect or whatever
|
$("#login").removeAttr("disabled");
|
||||||
|
window.location = "#/account";
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
display_message("status", "danger", data.message, function() {$("#login").removeAttr("disabled");});
|
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) {
|
}, function(data) {
|
||||||
$("#status").text(data.message);
|
$("#status").text(data.message);
|
||||||
if (data.success == 1) {
|
if (data.success == 1) {
|
||||||
display_message("status", "success", "Success!", function() {$("#register").removeAttr("disabled")});
|
display_message("status", "success", "Success!", function() {
|
||||||
// wait then redirect or whatever
|
$("#register").removeAttr("disabled");
|
||||||
|
window.location = "#/login";
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
display_message("status", "danger", data.message, function() {$("#register").removeAttr("disabled")});
|
display_message("status", "danger", data.message, function() {$("#register").removeAttr("disabled")});
|
||||||
grecaptcha.reset();
|
grecaptcha.reset();
|
||||||
|
|
Loading…
Reference in a new issue