fixed login issue
This commit is contained in:
@@ -7,5 +7,4 @@ let app = require('../irext_console.js');
|
|||||||
let authenticationService = require('../services/authentication_service.js');
|
let authenticationService = require('../services/authentication_service.js');
|
||||||
|
|
||||||
app.post('/irext/certificate/admin_login', authenticationService.adminLogin);
|
app.post('/irext/certificate/admin_login', authenticationService.adminLogin);
|
||||||
app.post('/irext/certificate/token_verify', authenticationService.verifyToken);
|
app.post('/irext/certificate/token_verify', authenticationService.verifyToken);
|
||||||
app.post('/irext/certificate/change_pw', authenticationService.changePassword);
|
|
||||||
@@ -54,23 +54,4 @@ exports.verifyToken = function (req, res) {
|
|||||||
res.send(serviceResponse);
|
res.send(serviceResponse);
|
||||||
res.end();
|
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();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mastfoot">
|
<div class="mastfoot">
|
||||||
<div class="inner">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mastfoot">
|
<div class="mastfoot">
|
||||||
<div class="inner">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<body class="page_index" style="background: #3F3F3F; color: #FFFFFF;">
|
<body class="page_index" style="background: #3F3F3F; color: #FFFFFF;">
|
||||||
<div class="navbar container">
|
<div class="navbar container">
|
||||||
<div class="header clearfix">
|
<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>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -27,12 +27,9 @@
|
|||||||
<label for="password" class="sr-only" data-i18n="page_index.d_signin_password">密码</label>
|
<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>
|
<input type="password" id="password" class="form-control" placeholder="Password" required>
|
||||||
<div class="row">
|
<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>
|
<button class="btn btn-lg btn-info" style="width: 100%;" data-i18n="page_index.d_signin_signin" onclick="signIn();">登入</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "IRext"
|
"name": "IRext"
|
||||||
},
|
},
|
||||||
"page_index": {
|
"page_index": {
|
||||||
"title": "IRext 本地控制台 - 0.2.5",
|
"title": "IRext 本地控制台 - 0.2.6",
|
||||||
"d_signin_title": "登入",
|
"d_signin_title": "登入",
|
||||||
"d_signin_email": "邮箱地址",
|
"d_signin_email": "邮箱地址",
|
||||||
"d_signin_password": "密码",
|
"d_signin_password": "密码",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "IRext"
|
"name": "IRext"
|
||||||
},
|
},
|
||||||
"page_index": {
|
"page_index": {
|
||||||
"title": "IRext Local Console - 0.2.5",
|
"title": "IRext Local Console - 0.2.6",
|
||||||
"d_signin_title": "Sign in",
|
"d_signin_title": "Sign in",
|
||||||
"d_signin_email": "Email",
|
"d_signin_email": "Email",
|
||||||
"d_signin_password": "Password",
|
"d_signin_password": "Password",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "IRext"
|
"name": "IRext"
|
||||||
},
|
},
|
||||||
"page_index": {
|
"page_index": {
|
||||||
"title": "IRext Local Console - 0.2.5",
|
"title": "IRext Local Console - 0.2.6",
|
||||||
"d_signin_title": "Sign in",
|
"d_signin_title": "Sign in",
|
||||||
"d_signin_email": "Email",
|
"d_signin_email": "Email",
|
||||||
"d_signin_password": "Password",
|
"d_signin_password": "Password",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "IRext"
|
"name": "IRext"
|
||||||
},
|
},
|
||||||
"page_index": {
|
"page_index": {
|
||||||
"title": "IRext 本地控制台 - 0.2.5",
|
"title": "IRext 本地控制台 - 0.2.6",
|
||||||
"d_signin_title": "登入",
|
"d_signin_title": "登入",
|
||||||
"d_signin_email": "邮箱地址",
|
"d_signin_email": "邮箱地址",
|
||||||
"d_signin_password": "密码",
|
"d_signin_password": "密码",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "IRext"
|
"name": "IRext"
|
||||||
},
|
},
|
||||||
"page_index": {
|
"page_index": {
|
||||||
"title": "IRext 本地控制台 - 0.2.5",
|
"title": "IRext 本地控制台 - 0.2.6",
|
||||||
"d_signin_title": "登入",
|
"d_signin_title": "登入",
|
||||||
"d_signin_email": "邮箱地址",
|
"d_signin_email": "邮箱地址",
|
||||||
"d_signin_password": "密码",
|
"d_signin_password": "密码",
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ let errorCode = new ErrorCode();
|
|||||||
|
|
||||||
let adminAuth = new AdminAuth(REDIS_HOST, REDIS_PORT, null, REDIS_PASSWORD);
|
let adminAuth = new AdminAuth(REDIS_HOST, REDIS_PORT, null, REDIS_PASSWORD);
|
||||||
|
|
||||||
let SIGN_IN_SERVICE = "/irext/certificate/admin_login";
|
let SIGN_IN_SERVICE = "/irext-server/app/admin_login";
|
||||||
let CHANGE_PASSWORD_SERVICE = "/irext/certificate/change_pw";
|
|
||||||
|
|
||||||
exports.adminLoginWorkUnit = function (userName, password, callback) {
|
exports.adminLoginWorkUnit = function (userName, password, callback) {
|
||||||
let queryParams = new Map();
|
let queryParams = new Map();
|
||||||
@@ -28,7 +27,7 @@ exports.adminLoginWorkUnit = function (userName, password, callback) {
|
|||||||
queryParams);
|
queryParams);
|
||||||
|
|
||||||
let signinInfo = {
|
let signinInfo = {
|
||||||
user_name : userName,
|
userName : userName,
|
||||||
password : password
|
password : password
|
||||||
};
|
};
|
||||||
requestSender.sendPostRequest(signinInfo,
|
requestSender.sendPostRequest(signinInfo,
|
||||||
@@ -95,32 +94,4 @@ exports.verifyTokenWithPermissionWorkUnit = function (id, token, permissions, ca
|
|||||||
callback(validateAdminAuthErr);
|
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user