Commit 2230a4a9 by NGUYEN HOANG SON

Merge branch 'feature/1.0_check_web_dev' into feature/1.0_check_web_dev_50270

parents 0ed1067c 43bb1ed4
......@@ -465,6 +465,15 @@ var ClientData = {
}
},
// Session : Tenant Service_Option(serviceOpt)_ChatFunction:Char(Y:Use, N:Unused)
serviceOpt_chat_function: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check);
}
},
// Session :事業者オプション(serviceOpt)_初回ログイン時パスワード強制変更:Integer(0:なし, 1:催促, 2:強制)
serviceOpt_force_pw_change_on_login: function (data) {
if (arguments.length > 0) {
......@@ -773,67 +782,6 @@ COMMON.lockLayout = function () {
});
}
};
/* show system error message */
COMMON.showSystemError = function (textId) {
if (COMMON.hasError()) {
// すでにエラー状態であればエラーを表示しない
return;
} else {
// エラー状態にセット
COMMON.setErrorState();
}
if (!textId) {
textId = 'sysErrorCallApi01';
}
// create DOM element for showing error message
var errMes = I18N.i18nText(textId);
var tags = '<div id="avw-sys-error"></div>';
//$('body').prepend(tags);
$('body').append(tags);
$('#avw-sys-error').css({
opacity: 0.7,
position: 'fixed',
top: '0',
left: '0',
width: $(window).width(),
height: $(window).height(),
background: '#999',
'z-index': 90000,
});
// resize error page
$(window).resize(function () {
$('#avw-sys-error').css({
width: $(window).width(),
height: $(window).height(),
});
});
// show error messages
$().toastmessage({ position: 'middle-center' });
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function () {
if (!HEADER.webLogoutEvent()) {
//ログアウト出来なかった
SessionStorageUtils.clear();
//カスタムURI起動対応のため sidのバックアップは消さない
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid);
COMMON.avwScreenMove(CONSTANT.PAGE_NAME.LOGIN);
}
},
});
/*
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function() { isShowErrorMessage = false; }
});
*/
};
/* エラー状態をクリア */
COMMON.clearError = function () {
......@@ -1246,22 +1194,10 @@ Array.prototype.clear = function () {
};
/* CMS API Call */
COMMON.callCmsApi = function (url, accountPath, apiName, type, params, async, success, error) {
COMMON.callCmsApi = function (url, type, params, async, success, error) {
// アプリケーション設定取得
var sysSettings = COMMON.sysSetting();
// url 構築
var apiUrl;
if (!url) {
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
} else {
apiUrl = url;
}
if (accountPath) {
apiUrl = COMMON.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
......@@ -1271,7 +1207,7 @@ COMMON.callCmsApi = function (url, accountPath, apiName, type, params, async, su
$.ajax({
async: async ? async : false,
type: type ? type : 'get',
url: apiUrl,
url: url,
cache: false,
dataType: 'json',
data: params,
......@@ -1290,17 +1226,29 @@ COMMON.callCmsApi = function (url, accountPath, apiName, type, params, async, su
success(data);
}
},
error: function (xmlHttpRequest, txtStatus, errorThrown) {
error: function (xhr, txtStatus, errorThrown) {
/* call custom error process */
if (error) {
error(xmlHttpRequest, txtStatus, errorThrown);
error(xhr, txtStatus, errorThrown);
} else {
if (xmlHttpRequest.status == 403) {
COMMON.showSystemError('sysErrorCallApi02');
COMMON.closeLoading();
if (xhr.responseText && xhr.status != 0) {
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), JSON.parse(xhr.responseText).errorMessage).toString());
} else {
COMMON.showSystemError();
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
}
$('#main-error-message').show();
}
},
});
};
// Function to set position of object to center
jQuery.fn.center = function() {
this.css("position", "fixed");
this.css("top", (($(window).height() - this.height()) / 2) + "px");
this.css("left", (($(window).width() - this.width()) / 2) + "px");
return this;
};
\ No newline at end of file
......@@ -45,11 +45,14 @@ CONSTANT.URL = {
CMS: {
// BASE_CMS: 'https://' + location.host + '/checkapi/web/',
BASE: 'http://localhost:8080/acms/',
//BASE: 'https://chatdev2.agentec.jp/acms/',
API: {
BASE: '/checkapi/web/',
ALL_OPERATION_LIST: 'operationListWeb/getOperationList',
AUTH_SESSION: 'getSession/checkAuthUser',
OPERATION_VIEW_LOG: 'operationViewLog/saveLog',
PASSWORD_CHANGE: 'passwordChangeWeb/',
LOGIN: 'webClientLogin/'
},
HTML: {
BASE: '/checkapi/web/html/',
......@@ -100,6 +103,8 @@ CONSTANT.KEYS = {
conf_apiResourceDlUrl: 'conf_apiResourceDlUrl',
// Session :ABookCheck:Char (Y: Yes, N: No)
serviceOpt_abook_check: 'abook_check',
// Session :Chat Function:Char (Y: Yes, N: No)
serviceOpt_chat_function: 'chat_function',
// Session: Enterprise Option (serviceOpt)_Any push message: Char (Y: Yes, N: No)
serviceOpt_usable_push_message: 'usable_push_message',
// Local
......
......@@ -127,7 +127,7 @@ var ValidationUtil = {
var count = 0;
var prev = 0;
for (var i = 0; i < str.length(); i++) {
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i);
if (i > 0 && prev == c) {
count++;
......
......@@ -9,6 +9,10 @@
"msgPwdEmpty":"Password is required.",
"msgPwdOldWrong":"Current Password mismatch.",
"msgPwdNotMatch":"New Password doesn't match.",
"msgMaxLength": "The new password length exceeds the maximum of 16 characters.",
"msgMinLength": "The new password length is less than a minimum of 6 characters.",
"msgHasSeqChar": "The new password contains at least three consecutive characters of the same character.",
"msgContainSameSeqChar": "The previous password cannot contain more than four characters.",
"msgLoginErrWrong":"LoginId or Password wrong: {0}",
"dspLogin":"Login",
"dspSkip":"Skip",
......
......@@ -9,6 +9,10 @@
"msgPwdEmpty":"パスワードを入力してください",
"msgPwdOldWrong":"現在のパスワードに誤りがあります",
"msgPwdNotMatch":"変更パスワードが一致していません。",
"msgMaxLength":"新規パスワードの長さが最大値16文字を超えています。",
"msgMinLength":"新規パスワードの長さが最小値6文字未満です。",
"msgHasSeqChar":"新規パスワードに同じ文字が3文字以上連続して使われています。",
"msgContainSameSeqChar":"前回パスワードに使用されている文字は4文字以上使えません。",
"msgLoginErrWrong":"ログインできません。入力情報を確認してください。(エラーコード:{0})",
"dspLogin":"ログイン",
"dspSkip":"スキップ",
......
......@@ -6,6 +6,10 @@
"txtUsrCap":"사용자 정보",
"txtLastLoginTime":"최종 로그인 시간:",
"msgMaxLength": "신규 비밀번호 길이가 최대치 16자를 초과합니다.",
"msgMinLength" : "신규 비밀번호 길이가 최소치 6글자 미만입니다.",
"msgHasSeqChar" : "신규 비밀번호에 같은 문자가 3글자 이상 연속적으로 사용되고 있습니다.",
"msgContainSameSeqChar": "지난번 비밀번호에 사용된 문자는 4글자 이상 사용할 수 없습니다.",
"msgPwdEmpty":"패스워드를 입력해 주십시오.",
"msgPwdOldWrong":"기존 패스워드를 바르게 입력해 주십시오.",
"msgPwdNotMatch":"신규 패스워드와 신규 패스워드 확인이 일치하지 않습니다.",
......
......@@ -79,6 +79,11 @@
</article>
</div>
</div>
<!--ローディング-->
<div id="check_loading" style="display:none; position: relative; overflow:hidden;">
<p id="checkLoadingMessage"></p>
<div id="checkLoadingImage"><img src='########' /></div>
</div>
<footer>
<div class="border">
<div class="cnt_footer">
......
......@@ -126,6 +126,30 @@ LOGIN.checkDialogValidation = function() {
msgError.attr('lang', 'msgPwdNotMatch');
msgError.show();
return false;
} else if (!ValidationUtil.CheckMinLengthForByte(newPass, 6)) {
LOGIN.login_errorMessage = "";
msgError.html(I18N.i18nText('msgMinLength'));
msgError.attr('lang', 'msgMinLength');
msgError.show();
return false;
} else if (!ValidationUtil.CheckMaxLengthForByte(newPass, 16)) {
LOGIN.login_errorMessage = "";
msgError.html(I18N.i18nText('msgMaxLength'));
msgError.attr('lang', 'msgMaxLength');
msgError.show();
return false;
} else if (ValidationUtil.HasSeqChar(newPass, 3)) {
LOGIN.login_errorMessage = "";
msgError.html(I18N.i18nText('msgHasSeqChar'));
msgError.attr('lang', 'msgHasSeqChar');
msgError.show();
return false;
} else if (ValidationUtil.ContainSameSeqChar(newPass, currentPass, 4)) {
LOGIN.login_errorMessage = "";
msgError.html(I18N.i18nText('msgContainSameSeqChar'));
msgError.attr('lang', 'msgContainSameSeqChar');
msgError.show();
return false;
} else {
return true;
}
......@@ -159,9 +183,9 @@ LOGIN.processLogin = function() {
}
// Get url to login
var apiLoginUrl = ClientData.conf_checkApiLoginUrl(); // sysSettings.apiLoginUrl;
url = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + CONSTANT.URL.CMS.API.LOGIN;
COMMON.callCmsApi(apiLoginUrl, null, 'webClientLogin', 'GET', params, true, function(data) {
COMMON.callCmsApi(url, 'POST', params, true, function(data) {
LOGIN.userinfo_sid = data.sid;
LOGIN.userInfo_userName = data.userName;
LOGIN.optionList = data.serviceOptionList;
......@@ -178,7 +202,7 @@ LOGIN.processLogin = function() {
console.log("data.requirePasswordChange:" + data.requirePasswordChange);
console.log("ClientData.serviceOpt_abook_check:" + ClientData.serviceOpt_abook_check());
COMMON.closeLoading();
if (data.requirePasswordChange == 0) {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
......@@ -269,6 +293,7 @@ LOGIN.processLogin = function() {
}
}
} else {
COMMON.closeLoading();
LOGIN.login_errorMessage = data.errorMessage;
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString());
$('#main-error-message').show();
......@@ -277,6 +302,7 @@ LOGIN.processLogin = function() {
}, function(xhr, statusText, errorThrown) {
LOGIN.login_error_flag = true;
COMMON.closeLoading();
if (xhr.responseText && xhr.status != 0) {
LOGIN.login_errorMessage = JSON.parse(xhr.responseText).errorMessage;
......@@ -290,7 +316,6 @@ LOGIN.processLogin = function() {
// Change Password Process
LOGIN.changePasswordProcess = function() {
var accountPath = $('#txtAccPath').val();
var sid = ClientData.userInfo_sid_local();
var loginId = $('#txtAccId').val();
var password = $('#txtCurrentPass').val();
......@@ -304,13 +329,14 @@ LOGIN.changePasswordProcess = function() {
appId : 4
};
AVWEB.avwCmsApiSync(accountPath, 'passwordChange', 'GET', params, function(data) {
var result = data.result;
if (result == 'success') {
$('#dialog-error-message').css('display', 'none');
const url = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + CONSTANT.URL.CMS.API.PASSWORD_CHANGE;
COMMON.callCmsApi(url, 'POST', params, false, function(result) {
if (result.httpStatus == '200') {
LOGIN.CloseChangePasswordDialog();
$('#dialog-error-message').css('display', 'none');
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
if (ClientData.serviceOpt_abook_check() == 'Y') {
// move to home.html page
COMMON.avwScreenMove("index.html");
......@@ -318,9 +344,10 @@ LOGIN.changePasswordProcess = function() {
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
}
} else {
$('#dialog-error-message').html(I18N.i18nText('msgPwdOldWrong'));
} else if (result.httpStatus == '401') {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else if (result.httpStatus == '403') {
$('#dialog-error-message').html(data.message);
$('#dialog-error-message').show();
}
}, function(xhr, b, c) {
......@@ -329,7 +356,8 @@ LOGIN.changePasswordProcess = function() {
$('#dialog-error-message').show();
} else {
// Show systemerror
COMMON.showSystemError();
COMMON.closeLoading();
COMMON.displayAlert('errorOccurred');
}
});
};
......@@ -363,8 +391,11 @@ LOGIN.changeLanguageEn = function() {
// Login click function
LOGIN.loginFunction = function() {
COMMON.showLoading();
if (LOGIN.checkValidation()) {
LOGIN.processLogin();
} else {
COMMON.closeLoading();
}
};
......@@ -397,12 +428,14 @@ LOGIN.OpenChangePasswordDialog = function() {
// Clear all input values
$("#main-password-change").show();
$("#main-password-change").center();
COMMON.lockLayout();
COMMON.showLoading();
console.log("password open");
};
// Close Chnage Password Dialog
LOGIN.CloseChangePasswordDialog = function() {
$("#main-password-change").hide();
COMMON.closeLoading();
};
// Save Service Option
......@@ -418,6 +451,8 @@ LOGIN.saveServiceUserOption = function() {
ClientData.serviceOpt_usable_push_message(option.value);
} else if (option.serviceOptionId == 161) {
ClientData.serviceOpt_abook_check(option.value);
} else if (option.serviceOptionId == 183) {
ClientData.serviceOpt_chat_function(option.value);
}
});
};
......
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