login redirection resolved

merge-requests/1/head
ayyoob 10 years ago
parent c50c7b36dc
commit 0b9e14ddb3

@ -33,6 +33,7 @@ if (uriMatcher.match("/{context}/api/user/login/")) {
var username = request.getParameter("username"); var username = request.getParameter("username");
var password = request.getParameter("password"); var password = request.getParameter("password");
var redirect = request.getParameter("redirect");
try { try {
userModule.login(username, password, function (user) { userModule.login(username, password, function (user) {
@ -40,13 +41,25 @@ if (uriMatcher.match("/{context}/api/user/login/")) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("User Logged In : " + user); log.debug("User Logged In : " + user);
} }
if(redirect==null){
response.sendRedirect(constants.WEB_APP_CONTEXT); response.sendRedirect(constants.WEB_APP_CONTEXT);
}else{
result=200;
}
}, function () { }, function () {
if(redirect==null){
response.sendRedirect(dcProps.appContext + "login?#auth-failed"); response.sendRedirect(dcProps.appContext + "login?#auth-failed");
}else{
result=401;
}
}); });
} catch (e) { } catch (e) {
log.error("Exception occurred while a user tried to login to DC", e); log.error("Exception occurred while a user tried to login to DC", e);
response.sendRedirect(dcProps.appContext + "login?#error"); response.sendRedirect(dcProps.appContext + "login?#error");
} }
} else if (uriMatcher.match("/{context}/api/user/logout/")) { } else if (uriMatcher.match("/{context}/api/user/logout/")) {

Loading…
Cancel
Save