Commit f0c78053 by Kang Donghun

コード整理、トークン処理追加

parent 4d55b513
...@@ -60,3 +60,9 @@ ul.message-list li.read{ ...@@ -60,3 +60,9 @@ ul.message-list li.read{
grid-template-columns: repeat(2,1fr); grid-template-columns: repeat(2,1fr);
} }
} }
.error {
font-size: 13px;
color: #FF0000;
font-weight: bolder;
}
\ No newline at end of file
...@@ -20,7 +20,7 @@ COMMON.hasErrorKey = 'AVW_HASERR'; ...@@ -20,7 +20,7 @@ COMMON.hasErrorKey = 'AVW_HASERR';
* @param {*} url * @param {*} url
*/ */
COMMON.avwScreenMove = function (url) { COMMON.avwScreenMove = function (url) {
COMMON.showLoading(); // COMMON.showLoading();
window.onbeforeunload = null; window.onbeforeunload = null;
window.location = url; window.location = url;
}; };
...@@ -32,9 +32,9 @@ COMMON.avwScreenMove = function (url) { ...@@ -32,9 +32,9 @@ COMMON.avwScreenMove = function (url) {
* @param {String} key * @param {String} key
*/ */
COMMON.showLoading = function () { COMMON.showLoading = function () {
$.LoadingOverlay('show', { // $.LoadingOverlay('show', {
image: '../common/img/loading.gif', // image: '../common/img/loading.gif',
}); // });
}; };
/** /**
...@@ -43,7 +43,7 @@ COMMON.showLoading = function () { ...@@ -43,7 +43,7 @@ COMMON.showLoading = function () {
COMMON.closeLoading = function () { COMMON.closeLoading = function () {
setTimeout(function () { setTimeout(function () {
$('#contentFieldOrverlay').show(); $('#contentFieldOrverlay').show();
$.LoadingOverlay('hide'); // $.LoadingOverlay('hide');
}, 500); }, 500);
}; };
...@@ -52,17 +52,22 @@ COMMON.closeLoading = function () { ...@@ -52,17 +52,22 @@ COMMON.closeLoading = function () {
* *
* @param {String} msgCode * @param {String} msgCode
*/ */
COMMON.displayAlert = function (msgCode, title) { COMMON.displayAlert = function (msgCode, isError) {
$('#alertMsg').html(I18N.i18nText(msgCode)); $('#msgModel').html(I18N.i18nText(msgCode));
$('.alert-overlay').removeClass('d-none'); $('#confirmYes').hide();
$('.alert-area').removeClass('d-none'); $('#confirmNo').text(I18N.i18nText("confirmation"));
$('#modalTitle').text(I18N.i18nText("error"));
const positionY = $(document).scrollTop() + screen.height / 8; if (isError) {
const height = screen.height / 4; }
$('.alert-overlay').css('height', screen.height); // $('.alert-overlay').removeClass('d-none');
$('.alert-area').css('top', positionY); // $('.alert-area').removeClass('d-none');
$('.alert-area').css('min-height', height);
$('body').css('overflow', 'hidden'); // const positionY = $(document).scrollTop() + screen.height / 8;
// const height = screen.height / 4;
// $('.alert-overlay').css('height', screen.height);
// $('.alert-area').css('top', positionY);
// $('.alert-area').css('min-height', height);
// $('body').css('overflow', 'hidden');
}; };
/** /**
...@@ -162,10 +167,10 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty ...@@ -162,10 +167,10 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
} else if (result.httpStatus == '401') { } else if (result.httpStatus == '401') {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN); COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else if (result.httpStatus == '403') { } else if (result.httpStatus == '403') {
COMMON.closeLoading(); // COMMON.closeLoading();
COMMON.displayAlert('errorOccurred'); COMMON.displayAlert('errorOccurred');
} else { } else {
COMMON.closeLoading(); // COMMON.closeLoading();
COMMON.displayAlert(result.message); COMMON.displayAlert(result.message);
} }
}, },
...@@ -173,7 +178,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty ...@@ -173,7 +178,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
if (errorCallback) { if (errorCallback) {
errorCallback(XMLHttpRequest, textStatus, errorThrown); errorCallback(XMLHttpRequest, textStatus, errorThrown);
} else { } else {
COMMON.closeLoading(); // COMMON.closeLoading();
COMMON.displayAlert('errorCommunicationFailed'); COMMON.displayAlert('errorCommunicationFailed');
} }
}, },
...@@ -182,7 +187,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty ...@@ -182,7 +187,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
if (errorCallback) { if (errorCallback) {
errorCallback(); errorCallback();
} else { } else {
COMMON.closeLoading(); // COMMON.closeLoading();
COMMON.displayAlert('errorOccurred'); COMMON.displayAlert('errorOccurred');
} }
} }
...@@ -960,6 +965,25 @@ COMMON.currentTime = function () { ...@@ -960,6 +965,25 @@ COMMON.currentTime = function () {
return Date.now(); return Date.now();
}; };
/**
* create UUID For token
*
*/
COMMON.generateUuid = function() {
var chars = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("");
for (var i = 0, len = chars.length; i < len; i++) {
switch (chars[i]) {
case "x":
chars[i] = Math.floor(Math.random() * 16).toString(16);
break;
case "y":
chars[i] = (Math.floor(Math.random() * 4) + 8).toString(16);
break;
}
}
return chars.join("");
}
/* /*
* Operations for session storage [ end ] * Operations for session storage [ end ]
*/ */
......
...@@ -99,6 +99,7 @@ CONSTANT.URL = { ...@@ -99,6 +99,7 @@ CONSTANT.URL = {
AUTH_SESSION: 'getSession/checkAuthUser', AUTH_SESSION: 'getSession/checkAuthUser',
OPERATION_VIEW_LOG: 'operationViewLog/saveLog', OPERATION_VIEW_LOG: 'operationViewLog/saveLog',
PASSWORD_CHANGE: 'passwordChangeWeb/', PASSWORD_CHANGE: 'passwordChangeWeb/',
PASSWORD_GET_TOKEN: 'passwordChangeWeb/getToken',
LOGIN: 'webClientLogin/', LOGIN: 'webClientLogin/',
LOGOUT: 'logoutWeb/', LOGOUT: 'logoutWeb/',
DASHBOARD: 'dashboard/', DASHBOARD: 'dashboard/',
......
...@@ -116,5 +116,6 @@ ...@@ -116,5 +116,6 @@
"categoryAll":"All", "categoryAll":"All",
"reportForm": "Report", "reportForm": "Report",
"periodicInspectionPeriod": "Periodic Inspection Period", "periodicInspectionPeriod": "Periodic Inspection Period",
"msgSendPushMessageSuccess":"we sent a push message" "msgSendPushMessageSuccess":"we sent a push message",
"error": "Error"
} }
\ No newline at end of file
...@@ -114,5 +114,6 @@ ...@@ -114,5 +114,6 @@
"categoryAll":"すべて", "categoryAll":"すべて",
"reportForm": "報告", "reportForm": "報告",
"periodicInspectionPeriod": "定期点検期間", "periodicInspectionPeriod": "定期点検期間",
"msgSendPushMessageSuccess":"プッシュメッセージ送信しました。" "msgSendPushMessageSuccess":"プッシュメッセージ送信しました。",
"error": "エラー"
} }
\ No newline at end of file
...@@ -113,5 +113,6 @@ ...@@ -113,5 +113,6 @@
"categoryAll":"All", "categoryAll":"All",
"reportForm": "보고서", "reportForm": "보고서",
"periodicInspectionPeriod": "정기점검기간", "periodicInspectionPeriod": "정기점검기간",
"msgSendPushMessageSuccess":"푸시메시지를 보냈습니다." "msgSendPushMessageSuccess":"푸시메시지를 보냈습니다.",
"error": "에러"
} }
\ No newline at end of file
...@@ -33,12 +33,9 @@ ...@@ -33,12 +33,9 @@
<!-- header --> <!-- header -->
<div id="includedHeader"></div> <div id="includedHeader"></div>
<!-- account setting --> <!-- account setting -->
<div id="includedMainTitle"></div>
<main id="main"> <main id="main">
<div class="container-wrap"> <div class="container-wrap">
<!-- title -->
<div id="includedMainTitle"></div>
<h1 class="fs-14 font-weight-bold pt-4 pb-3 mb-0 lang" lang="accountSetting"></h1>
<!-- content --> <!-- content -->
<div class="row"> <div class="row">
<div class="col-md-6 col-12 mb-4"> <div class="col-md-6 col-12 mb-4">
...@@ -64,26 +61,26 @@ ...@@ -64,26 +61,26 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-md-6 col-12 mb-4"> </div>
<div class="card p-4 password"> <div class="col-md-6 col-12 mb-4">
<h2 class="fs-10 font-weight-bold mb-3 lang" lang="dspPwdUpd">パスワード変更</h2> <div class="card p-4 password">
<form> <h2 class="fs-10 font-weight-bold mb-3 lang" lang="dspPwdUpd">パスワード変更</h2>
<div class="form-group mb-3"> <form>
<label id="lblPwdCur" class="lang" lang="txtPwdCurr">現在のパスワード</label> <div class="form-group mb-3">
<input type="password" class="form-control" id="txtPwdCur" maxlength="16" aria-describedby="current"> <label id="lblPwdCur" class="lang" lang="txtPwdCurr">現在のパスワード</label>
</div> <input type="password" class="form-control" id="txtPwdCur" maxlength="16" aria-describedby="current">
<div class="form-group mb-3"> </div>
<label id="lblPwdNew" class="lang" lang="txtPwdNew">新しいパスワード</label> <div class="form-group mb-3">
<input type="password" class="form-control" id="txtPwdNew" maxlength="16" aria-describedby="new"> <label id="lblPwdNew" class="lang" lang="txtPwdNew">新しいパスワード</label>
</div> <input type="password" class="form-control" id="txtPwdNew" maxlength="16" aria-describedby="new">
<div class="form-group mb-4"> </div>
<label id="lblPwdNewRe" class="lang" lang="txtPwdNewRe">新しいパスワード</label> <div class="form-group mb-4">
<input type="password" class="form-control" id="txtPwdNewRe" maxlength="16" aria-describedby="confirm"> <label id="lblPwdNewRe" class="lang" lang="txtPwdNewRe">新しいパスワード</label>
</div> <input type="password" class="form-control" id="txtPwdNewRe" maxlength="16" aria-describedby="confirm">
<p class="error lang" id="main-error-message" style="display:none;">パスワードまたはIDに誤りがあります</p> </div>
<button type="submit" class="btn btn-primary lang" lang="dspChange" id="dspPwdUpd1">変更</button> <p class="error lang" id="main-error-message" style="display:none;">パスワードまたはIDに誤りがあります</p>
</form> <button type="submit" class="btn btn-primary lang" lang="dspChange" id="dspPwdUpd1">変更</button>
</div> </form>
</div> </div>
</div> </div>
</div> </div>
...@@ -96,7 +93,7 @@ ...@@ -96,7 +93,7 @@
<i class="text-right fas fa-times fa-2x loading-close" onclick="COMMON.alertClose();"></i> <i class="text-right fas fa-times fa-2x loading-close" onclick="COMMON.alertClose();"></i>
<div class="fs-13 mt-4 text-left" style="padding: 15px;" id="alertMsg"></div> <div class="fs-13 mt-4 text-left" style="padding: 15px;" id="alertMsg"></div>
</div> </div>
<input type="hidden" id="getToken">
<!-- confirm --> <!-- confirm -->
<div id="includedConfirmModal"></div> <div id="includedConfirmModal"></div>
<script type="text/javascript" src="../common/js/app.js?__UPDATEID__"></script> <script type="text/javascript" src="../common/js/app.js?__UPDATEID__"></script>
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
<script src="../common/js/constant.js?__UPDATEID__"></script> <script src="../common/js/constant.js?__UPDATEID__"></script>
<script src="../common/js/common.js?__UPDATEID__"></script> <script src="../common/js/common.js?__UPDATEID__"></script>
<script src="../common/js/header.js?__UPDATEID__"></script> <script src="../common/js/header.js?__UPDATEID__"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gasparesganga-jquery-loading-overlay@2.1.7/dist/loadingoverlay.min.js"></script>
<script src="../js/template/template.js?__UPDATEID__"></script> <script src="../js/template/template.js?__UPDATEID__"></script>
<script src="../js/operationList/operationList.js?__UPDATEID__"></script> <script src="../js/operationList/operationList.js?__UPDATEID__"></script>
......
...@@ -390,11 +390,11 @@ LOGIN.changeLanguage = function (lang) { ...@@ -390,11 +390,11 @@ LOGIN.changeLanguage = function (lang) {
// Login click function // Login click function
LOGIN.loginFunction = function () { LOGIN.loginFunction = function () {
COMMON.showLoading(); // COMMON.showLoading();
if (LOGIN.checkValidation()) { if (LOGIN.checkValidation()) {
LOGIN.processLogin(); LOGIN.processLogin();
} else { } else {
COMMON.closeLoading(); // COMMON.closeLoading();
} }
}; };
...@@ -424,14 +424,14 @@ LOGIN.skipPassFunction = function () { ...@@ -424,14 +424,14 @@ LOGIN.skipPassFunction = function () {
// Open Change Password Dialog // Open Change Password Dialog
LOGIN.OpenChangePasswordDialog = function () { LOGIN.OpenChangePasswordDialog = function () {
$('#password-reset-modal').show(); $('#password-reset-modal').show();
COMMON.showLoading(); // COMMON.showLoading();
console.log('password open'); console.log('password open');
}; };
// Close Chnage Password Dialog // Close Chnage Password Dialog
LOGIN.CloseChangePasswordDialog = function () { LOGIN.CloseChangePasswordDialog = function () {
$('#main-password-change').hide(); $('#main-password-change').hide();
COMMON.closeLoading(); // COMMON.closeLoading();
}; };
// Save Service Option // Save Service Option
......
...@@ -449,7 +449,7 @@ OL.sortOperationList = function (sortNumber) { ...@@ -449,7 +449,7 @@ OL.sortOperationList = function (sortNumber) {
* search operarionList * search operarionList
*/ */
OL.search = function () { OL.search = function () {
COMMON.showLoading(); // COMMON.showLoading();
const searchKeyword = $('#searchTaskName').val(); const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val(); const searchStartDate = $('#searchStartDate').val();
const searchEndDate = $('#searchEndDate').val(); const searchEndDate = $('#searchEndDate').val();
......
...@@ -16,10 +16,7 @@ RL.init = function () { ...@@ -16,10 +16,7 @@ RL.init = function () {
RL.checkQuickReport(); RL.checkQuickReport();
RL.loadCommon(); RL.loadCommon();
RL.initTaskReportList(); RL.initTaskReportList();
<<<<<<< HEAD
// COMMON.closeLoading(); // COMMON.closeLoading();
=======
>>>>>>> 10c2cc5b3dcd3a3e569902c5e870db4e067ce037
}; };
/** /**
......
...@@ -4,18 +4,34 @@ ...@@ -4,18 +4,34 @@
**/ **/
var SETTINGS = {}; var SETTINGS = {};
// SETTINGS.TOKEN_VALUE = "";
// Init function of page // Init function of page
$(document).ready(function () { $(document).ready(function () {
//Check if user is logged in //Check if user is logged in
// SETTINGS.TOKEN_VALUE = random;
COMMON.checkAuth(false); COMMON.checkAuth(false);
SETTINGS.getToken();
SETTINGS.initScreen(); SETTINGS.initScreen();
$('#dspPwdUpd1').click(SETTINGS.dspPwdUpd1_Click); $('#dspPwdUpd1').click(SETTINGS.dspPwdUpd1_Click);
COMMON.closeLoading(); // COMMON.closeLoading();
}); });
SETTINGS.getToken = function () {
var params = {
sid: ClientData.userInfo_sid(),
};
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_GET_TOKEN;
COMMON.cmsAjax(url, params, false,
function(data) {
$('#getToken').val(data);
},
function(data) {
if (data.errorMessage) {
COMMON.displayAlert(data.errorMessage);
} else {
COMMON.displayAlert('msgPwdChangeOK');
}
});
};
/** /**
* Process changing password * Process changing password
* @param {*} e * @param {*} e
...@@ -75,17 +91,22 @@ SETTINGS.dspPwdUpd1_Click = function (e) { ...@@ -75,17 +91,22 @@ SETTINGS.dspPwdUpd1_Click = function (e) {
} }
// Do changing password // Do changing password
if (isOK) { if (isOK) {
var getToken = $("#getToken").val();
var params = { var params = {
sid: ClientData.userInfo_sid(), sid: ClientData.userInfo_sid(),
loginId: ClientData.userInfo_loginId_session(), loginId: ClientData.userInfo_loginId_session(),
password: SETTINGS.getCurrentPassword(), password: SETTINGS.getCurrentPassword(),
newPassword: SETTINGS.getNewPassword(), newPassword: SETTINGS.getNewPassword(),
language: I18N.getCurrentLanguage(), language: I18N.getCurrentLanguage(),
token: "", token: getToken,
appId: 4, appId: 4,
}; };
// if (SETTINGS.TOKEN_VALUE != getToken) {
// COMMON.displayAlert("error");
// return;
// }
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_CHANGE; const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_CHANGE;
COMMON.cmsAjax(url, params, false, SETTINGS.avwCmsApi_passwordChange_success, SETTINGS.avwCmsApi_passwordChange_fail); COMMON.cmsAjax(url, params, false, SETTINGS.avwCmsApi_passwordChange_success, SETTINGS.avwCmsApi_passwordChange_fail);
} else { } else {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
var TEMPLATE = {}; var TEMPLATE = {};
/** template load header */ /** template load header */
TEMPLATE.loadHearder = function (elmentId) { TEMPLATE.loadHeader = function (elmentId) {
// COMMON.showLoading(); // COMMON.showLoading();
$(elmentId).load('../common/html/header.html', function () { $(elmentId).load('../common/html/header.html', function () {
$('#iconHomeDashboard').removeClass('active'); $('#iconHomeDashboard').removeClass('active');
......
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