/*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.