Commit c33df82b by 宋毅

tj

parent 185e5384
......@@ -52,5 +52,20 @@ class AccessAuthAPI extends APIBase {
var result = await this.opPlatformUtils.getReqUserPinByLgoinVcode(pobj);
return result;
}
async modiPasswordByMobile(pobj, qobj, req) {
var actionBody = pobj.actionBody;
if (!actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !");
}
if (!actionBody.vcode) {
return system.getResult(null, "actionBody.vcode can not be empty !");
}
if (!actionBody.newPwd) {
return system.getResult(null, "actionBody.newPwd can not be empty !");
}
var result = await this.opPlatformUtils.putUserPwdByMobile(pobj, actionBody);
return result;
}
}
module.exports = AccessAuthAPI;
\ No newline at end of file
......@@ -10,6 +10,7 @@ class OpPlatformUtils {
this.fetchDefaultVCodeUrl = settings.paasUrl() + "api/auth/accessAuth/fetchDefaultVCode";
this.loginUrl = settings.paasUrl() + "api/auth/accessAuth/login";
this.loginByVCodeUrl = settings.paasUrl() + "api/auth/accessAuth/loginByVCode";
this.modiPasswordByMobileUrl = settings.paasUrl() + "api/auth/accessAuth/modiPasswordByMobile";
}
getUUID() {
var uuid = uuidv4();
......@@ -193,6 +194,23 @@ class OpPlatformUtils {
return system.getResultSuccess(restResult.data);
}
async modiPasswordByMobile(mobile, vcode, newPwd, appKey, secret) {
var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret);
if (reqApiAccessKey.status != 0) {
return reqApiAccessKey;
}
var param = { mobile: mobile, vcode: vcode, newPwd: newPwd }
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.modiPasswordByMobileUrl, reqApiAccessKey.data.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(null, restResult.msg);
}
return system.getResultSuccess();
}
//------------------------新的方式------------------------------------------------------------------------------------
async getReqTokenByHosts(app_hosts) {
var cacheManager = system.getObject("db.common.cacheManager");
......@@ -229,6 +247,24 @@ class OpPlatformUtils {
result = await cacheManager["AppUserPinByLoginVcodeCache"].cache(inputkey, pobj, system.shortExTime);
return result;
}
async putUserPwdByMobile(pobj, actionBody) {
if (!actionBody.mobile) {
return system.getResult(null, "pobj.mobile can not be empty !");
}
if (!actionBody.vcode) {
return system.getResult(null, "pobj.vcode can not be empty !");
}
if (!actionBody.newPwd) {
return system.getResult(null, "pobj.newPwd can not be empty !");
}
if (!actionBody.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !");
}
var acckapp = await this.modiPasswordByMobile(actionBody.mobile, actionBody.vcode, actionBody.newPwd, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
return acckapp;
}
}
module.exports = OpPlatformUtils;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment