Commit f0c78053 by Kang Donghun

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

parent 4d55b513
......@@ -60,3 +60,9 @@ ul.message-list li.read{
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';
* @param {*} url
*/
COMMON.avwScreenMove = function (url) {
COMMON.showLoading();
// COMMON.showLoading();
window.onbeforeunload = null;
window.location = url;
};
......@@ -32,9 +32,9 @@ COMMON.avwScreenMove = function (url) {
* @param {String} key
*/
COMMON.showLoading = function () {
$.LoadingOverlay('show', {
image: '../common/img/loading.gif',
});
// $.LoadingOverlay('show', {
// image: '../common/img/loading.gif',
// });
};
/**
......@@ -43,7 +43,7 @@ COMMON.showLoading = function () {
COMMON.closeLoading = function () {
setTimeout(function () {
$('#contentFieldOrverlay').show();
$.LoadingOverlay('hide');
// $.LoadingOverlay('hide');
}, 500);
};
......@@ -52,17 +52,22 @@ COMMON.closeLoading = function () {
*
* @param {String} msgCode
*/
COMMON.displayAlert = function (msgCode, title) {
$('#alertMsg').html(I18N.i18nText(msgCode));
$('.alert-overlay').removeClass('d-none');
$('.alert-area').removeClass('d-none');
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');
COMMON.displayAlert = function (msgCode, isError) {
$('#msgModel').html(I18N.i18nText(msgCode));
$('#confirmYes').hide();
$('#confirmNo').text(I18N.i18nText("confirmation"));
$('#modalTitle').text(I18N.i18nText("error"));
if (isError) {
}
// $('.alert-overlay').removeClass('d-none');
// $('.alert-area').removeClass('d-none');
// 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
} else if (result.httpStatus == '401') {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else if (result.httpStatus == '403') {
COMMON.closeLoading();
// COMMON.closeLoading();
COMMON.displayAlert('errorOccurred');
} else {
COMMON.closeLoading();
// COMMON.closeLoading();
COMMON.displayAlert(result.message);
}
},
......@@ -173,7 +178,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
if (errorCallback) {
errorCallback(XMLHttpRequest, textStatus, errorThrown);
} else {
COMMON.closeLoading();
// COMMON.closeLoading();
COMMON.displayAlert('errorCommunicationFailed');
}
},
......@@ -182,7 +187,7 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
if (errorCallback) {
errorCallback();
} else {
COMMON.closeLoading();
// COMMON.closeLoading();
COMMON.displayAlert('errorOccurred');
}
}
......@@ -960,6 +965,25 @@ COMMON.currentTime = function () {
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 ]
*/
......
......@@ -99,6 +99,7 @@ CONSTANT.URL = {
AUTH_SESSION: 'getSession/checkAuthUser',
OPERATION_VIEW_LOG: 'operationViewLog/saveLog',
PASSWORD_CHANGE: 'passwordChangeWeb/',
PASSWORD_GET_TOKEN: 'passwordChangeWeb/getToken',
LOGIN: 'webClientLogin/',
LOGOUT: 'logoutWeb/',
DASHBOARD: 'dashboard/',
......
......@@ -116,5 +116,6 @@
"categoryAll":"All",
"reportForm": "Report",
"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 @@
"categoryAll":"すべて",
"reportForm": "報告",
"periodicInspectionPeriod": "定期点検期間",
"msgSendPushMessageSuccess":"プッシュメッセージ送信しました。"
"msgSendPushMessageSuccess":"プッシュメッセージ送信しました。",
"error": "エラー"
}
\ No newline at end of file
......@@ -113,5 +113,6 @@
"categoryAll":"All",
"reportForm": "보고서",
"periodicInspectionPeriod": "정기점검기간",
"msgSendPushMessageSuccess":"푸시메시지를 보냈습니다."
"msgSendPushMessageSuccess":"푸시메시지를 보냈습니다.",
"error": "에러"
}
\ No newline at end of file
......@@ -33,12 +33,9 @@
<!-- header -->
<div id="includedHeader"></div>
<!-- account setting -->
<div id="includedMainTitle"></div>
<main id="main">
<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 -->
<div class="row">
<div class="col-md-6 col-12 mb-4">
......@@ -64,6 +61,7 @@
</tbody>
</table>
</div>
</div>
<div class="col-md-6 col-12 mb-4">
<div class="card p-4 password">
<h2 class="fs-10 font-weight-bold mb-3 lang" lang="dspPwdUpd">パスワード変更</h2>
......@@ -87,7 +85,6 @@
</div>
</div>
</div>
</div>
</main>
<!-- alert -->
......@@ -96,7 +93,7 @@
<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>
<input type="hidden" id="getToken">
<!-- confirm -->
<div id="includedConfirmModal"></div>
<script type="text/javascript" src="../common/js/app.js?__UPDATEID__"></script>
......
......@@ -21,8 +21,6 @@
<script src="../common/js/constant.js?__UPDATEID__"></script>
<script src="../common/js/common.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/operationList/operationList.js?__UPDATEID__"></script>
......
......@@ -390,11 +390,11 @@ LOGIN.changeLanguage = function (lang) {
// Login click function
LOGIN.loginFunction = function () {
COMMON.showLoading();
// COMMON.showLoading();
if (LOGIN.checkValidation()) {
LOGIN.processLogin();
} else {
COMMON.closeLoading();
// COMMON.closeLoading();
}
};
......@@ -424,14 +424,14 @@ LOGIN.skipPassFunction = function () {
// Open Change Password Dialog
LOGIN.OpenChangePasswordDialog = function () {
$('#password-reset-modal').show();
COMMON.showLoading();
// COMMON.showLoading();
console.log('password open');
};
// Close Chnage Password Dialog
LOGIN.CloseChangePasswordDialog = function () {
$('#main-password-change').hide();
COMMON.closeLoading();
// COMMON.closeLoading();
};
// Save Service Option
......
......@@ -449,7 +449,7 @@ OL.sortOperationList = function (sortNumber) {
* search operarionList
*/
OL.search = function () {
COMMON.showLoading();
// COMMON.showLoading();
const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val();
const searchEndDate = $('#searchEndDate').val();
......
......@@ -16,10 +16,7 @@ RL.init = function () {
RL.checkQuickReport();
RL.loadCommon();
RL.initTaskReportList();
<<<<<<< HEAD
// COMMON.closeLoading();
=======
>>>>>>> 10c2cc5b3dcd3a3e569902c5e870db4e067ce037
};
/**
......
......@@ -4,18 +4,34 @@
**/
var SETTINGS = {};
// SETTINGS.TOKEN_VALUE = "";
// Init function of page
$(document).ready(function () {
//Check if user is logged in
// SETTINGS.TOKEN_VALUE = random;
COMMON.checkAuth(false);
SETTINGS.getToken();
SETTINGS.initScreen();
$('#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
* @param {*} e
......@@ -77,15 +93,20 @@ SETTINGS.dspPwdUpd1_Click = function (e) {
// Do changing password
if (isOK) {
var getToken = $("#getToken").val();
var params = {
sid: ClientData.userInfo_sid(),
loginId: ClientData.userInfo_loginId_session(),
password: SETTINGS.getCurrentPassword(),
newPassword: SETTINGS.getNewPassword(),
language: I18N.getCurrentLanguage(),
token: "",
token: getToken,
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;
COMMON.cmsAjax(url, params, false, SETTINGS.avwCmsApi_passwordChange_success, SETTINGS.avwCmsApi_passwordChange_fail);
} else {
......
......@@ -5,7 +5,7 @@
var TEMPLATE = {};
/** template load header */
TEMPLATE.loadHearder = function (elmentId) {
TEMPLATE.loadHeader = function (elmentId) {
// COMMON.showLoading();
$(elmentId).load('../common/html/header.html', function () {
$('#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