fixed login issue

This commit is contained in:
strawmanbobi
2020-12-02 20:57:55 +08:00
parent bef31aac0c
commit a6ad39ce0d
11 changed files with 12 additions and 64 deletions

View File

@@ -7,5 +7,4 @@ let app = require('../irext_console.js');
let authenticationService = require('../services/authentication_service.js');
app.post('/irext/certificate/admin_login', authenticationService.adminLogin);
app.post('/irext/certificate/token_verify', authenticationService.verifyToken);
app.post('/irext/certificate/change_pw', authenticationService.changePassword);
app.post('/irext/certificate/token_verify', authenticationService.verifyToken);

View File

@@ -54,23 +54,4 @@ exports.verifyToken = function (req, res) {
res.send(serviceResponse);
res.end();
});
};
/*
* function : Change password
* parameter : id parameter of token KV
* token parameter of token KV
* return : ServiceResponse
*/
exports.changePassword = function (req, res) {
let bodyParam = req.body;
let userName = bodyParam.user_name;
let callbackURL = bodyParam.callback_url;
let serviceResponse = new ServiceResponse();
authenticationLogic.sendChangePwMailWorkUnit(userName, callbackURL, function (changePWErr) {
serviceResponse.status = changePWErr;
res.send(serviceResponse);
res.end();
});
};

View File

@@ -27,7 +27,7 @@
</div>
<div class="mastfoot">
<div class="inner">
<p> <a href="http://irext.net"> irext.net </a></p>
<p> <a href="http://cc.irext.net"> irext.net </a></p>
</div>
</div>
</div>

View File

@@ -31,7 +31,7 @@
</div>
<div class="mastfoot">
<div class="inner">
<p> <a href="http://irext.net"> irext.net </a></p>
<p> <a href="http://cc.irext.net"> irext.net </a></p>
</div>
</div>
</div>

View File

@@ -15,7 +15,7 @@
<body class="page_index" style="background: #3F3F3F; color: #FFFFFF;">
<div class="navbar container">
<div class="header clearfix">
<h3 data-i18n="page_index.title">IRext 本地控制台 - 0.2.5</h3>
<h3 data-i18n="page_index.title">IRext 本地控制台 - 0.2.6</h3>
</div>
</div>
<div class="container">
@@ -27,12 +27,9 @@
<label for="password" class="sr-only" data-i18n="page_index.d_signin_password">密码</label>
<input type="password" id="password" class="form-control" placeholder="Password" required>
<div class="row">
<div class="col-lg-6">
<div class="col-lg-12">
<button class="btn btn-lg btn-info" style="width: 100%;" data-i18n="page_index.d_signin_signin" onclick="signIn();">登入</button>
</div>
<div class="col-lg-6">
<button class="btn btn-lg btn-warning" style="width: 100%;" data-i18n="page_index.d_changepw_title" onclick="onChangePassword();">重置密码</button>
</div>
</div>
</div>
</div>

View File

@@ -3,7 +3,7 @@
"name": "IRext"
},
"page_index": {
"title": "IRext 本地控制台 - 0.2.5",
"title": "IRext 本地控制台 - 0.2.6",
"d_signin_title": "登入",
"d_signin_email": "邮箱地址",
"d_signin_password": "密码",

View File

@@ -3,7 +3,7 @@
"name": "IRext"
},
"page_index": {
"title": "IRext Local Console - 0.2.5",
"title": "IRext Local Console - 0.2.6",
"d_signin_title": "Sign in",
"d_signin_email": "Email",
"d_signin_password": "Password",

View File

@@ -3,7 +3,7 @@
"name": "IRext"
},
"page_index": {
"title": "IRext Local Console - 0.2.5",
"title": "IRext Local Console - 0.2.6",
"d_signin_title": "Sign in",
"d_signin_email": "Email",
"d_signin_password": "Password",

View File

@@ -3,7 +3,7 @@
"name": "IRext"
},
"page_index": {
"title": "IRext 本地控制台 - 0.2.5",
"title": "IRext 本地控制台 - 0.2.6",
"d_signin_title": "登入",
"d_signin_email": "邮箱地址",
"d_signin_password": "密码",

View File

@@ -3,7 +3,7 @@
"name": "IRext"
},
"page_index": {
"title": "IRext 本地控制台 - 0.2.5",
"title": "IRext 本地控制台 - 0.2.6",
"d_signin_title": "登入",
"d_signin_email": "邮箱地址",
"d_signin_password": "密码",

View File

@@ -15,8 +15,7 @@ let errorCode = new ErrorCode();
let adminAuth = new AdminAuth(REDIS_HOST, REDIS_PORT, null, REDIS_PASSWORD);
let SIGN_IN_SERVICE = "/irext/certificate/admin_login";
let CHANGE_PASSWORD_SERVICE = "/irext/certificate/change_pw";
let SIGN_IN_SERVICE = "/irext-server/app/admin_login";
exports.adminLoginWorkUnit = function (userName, password, callback) {
let queryParams = new Map();
@@ -28,7 +27,7 @@ exports.adminLoginWorkUnit = function (userName, password, callback) {
queryParams);
let signinInfo = {
user_name : userName,
userName : userName,
password : password
};
requestSender.sendPostRequest(signinInfo,
@@ -95,32 +94,4 @@ exports.verifyTokenWithPermissionWorkUnit = function (id, token, permissions, ca
callback(validateAdminAuthErr);
}
});
};
exports.sendChangePwMailWorkUnit = function (userName, callbackURL, callback) {
let queryParams = new Map();
let requestSender =
new RequestSender(EXTERNAL_SERVER_ADDRESS,
EXTERNAL_SERVER_PORT,
CHANGE_PASSWORD_SERVICE,
queryParams);
let userInfo = {
user_name : userName,
callback_url :callbackURL
};
requestSender.sendPostRequest(userInfo,
function(changePwRequestErr, changePwResponse) {
if (changePwRequestErr === errorCode.SUCCESS.code && null != changePwResponse) {
let resp = JSON.parse(changePwResponse);
if (undefined !== resp.status && errorCode.SUCCESS === resp.status) {
callback(errorCode.SUCCESS);
} else {
callback(errorCode.FAILED);
}
} else {
callback(errorCode.FAILED);
}
});
};