updated admin login and password change functionality

This commit is contained in:
strawmanbobi
2016-12-07 21:35:14 +08:00
parent 76a5a8155d
commit c296f5e53b

View File

@@ -39,7 +39,9 @@ exports.adminLoginWorkUnit = function (userName, password, callback) {
requestSender.sendPostRequest(signinInfo,
function(signInRequestErr, signInResponse) {
if (signInRequestErr == errorCode.SUCCESS.code && null != signInResponse) {
var admin = JSON.parse(signInResponse).entity;
var resp = JSON.parse(signInResponse);
if (undefined != resp.entity) {
var admin = resp.entity;
var userID,
token,
key,
@@ -53,6 +55,10 @@ exports.adminLoginWorkUnit = function (userName, password, callback) {
admin.token = token;
callback(setAdminAuthErr, admin);
});
} else {
callback(errorCode.FAILED, null);
}
} else {
logger.error("admin sign in failed");
callback(errorCode.FAILED, null);
@@ -107,10 +113,15 @@ exports.sendChangePwMailWorkUnit = function (userName, callback) {
requestSender.sendPostRequest(userInfo,
function(changePwRequestErr, changePwResponse) {
if (changePwRequestErr == errorCode.SUCCESS.code && null != changePwResponse) {
var resp = JSON.parse(changePwResponse);
if (undefined != resp.status && errorCode.SUCCESS == resp.status) {
callback(errorCode.SUCCESS);
} else {
callback(errorCode.FAILED);
}
} else {
callback(errorCode.FAILED);
}
});
};