/*global $ */ $(document).ready(function () { 'use strict'; var linktype, method; $('#userId').on('keypress', function (event) { if ((event.keyCode || event.which) === 13) { $('#password').focus(); } }); $('#password').on('keypress', function (event) { if ((event.keyCode || event.which) === 13) { method(); } }); $('#login').on('click', function (event) { method(); }); method = function () { var $form; $form = $('
', { action: './login', method: 'post', style: 'display: none;' }); $form.append($('', { type: 'hidden', name: 'userId', value: $('#userId').val() })); $form.append($('', { type: 'hidden', name: 'password', value: $('#password').val() })); $form.append($('', { type: 'hidden', name: 'pageid', value: $('#pageid').val() })); $('body').append($form); $form.submit(); $form.remove(); return false; }; $('#_popupForgot').dialog({ autoOpen: false, modal: true, resizable: false, width: 'auto', title: '', buttons: [{ text: 'Cancel', click: function () { $(this).dialog('close'); } }, { text: 'Send', click: function () { var inputTxt; inputTxt = $('#_popupForgot #inputTxt'); if (inputTxt.val() === '') { $('#_popupAlert>p').text('Please enter [' + $('#_popupForgot #labelTxt').text() + ']'); $('#_popupAlert').dialog('open'); return; } $.blockUI(); $.post('./api/user-send_forgot_mail', { applyformname: $('#search_list_applyFormName').val(), type: linktype, inputdata: inputTxt.val() }) .done(function (resData, textStatus, jqXHR) { if (resData.resultcd === 0) { $('#_popupAlert>p').text('Sent'); $('#_popupAlert').dialog('open'); } else { console.debug('@ api:user-send_forgot_mai failed @', resData.resultcd); } }) .fail(function (jqXHR, textStatus, errorThrown) { console.debug('@ api:user-send_forgot_mai failed @', jqXHR.status); }) .always(function () { $('#_popupForgot').dialog('close'); $.unblockUI(); }); } }], open: function () { $(this).find('#inputTxt') .val(''); if (linktype === 'loginid') { $(this).find('#labelTxt') .text('Email address'); $(this).find('#msgTxt') .html('Your login ID will be sent to your registered email address.
Please enter your e-mail address.'); } else if (linktype === 'password') { $(this).find('#labelTxt') .text('Login ID'); $(this).find('#msgTxt') .html('A password change screen guide will be sent to
the email address registered with the entered login ID.'); } }, close: function () { $(this).dialog('close'); } }); $('#_popupAlert').dialog({ autoOpen: false, modal: true, resizable: false, width: 'auto', buttons: [ { text: 'Close', click: function () { $(this).dialog('close'); } } ] }); $('.login_forgot').on('click', function (event) { event.stopPropagation(); linktype = $(this).data('linktype'); $('#_popupForgot').dialog('open'); return false; }); if (window.location.pathname === '/login' && window.top.location.pathname !== '/login') { window.top.location.pathname = '/login'; } });