Add project files.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Security page scripts.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.doSignin = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajaxSignin = sax.ajaxSignin || { url: sax.url.base + 'Security/Ajax/Signin', formId: 'frmSignIn', callbackFn: sax.onSignin };
|
||||
sax.doAjaxRequest(sax.ajaxSignin, 50);
|
||||
}
|
||||
sax.onSignin = function (response)
|
||||
{
|
||||
sax.debug(response);
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
sax.goToPage('');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.doScorePassword = function ()
|
||||
{
|
||||
sax.ajaxScorePassword = sax.ajaxScorePassword || { url: sax.url.base + 'Security/Ajax/ScorePassword', formId: 'frmChangePassword', callbackFn: sax.onScorePassword, noWaitIcon: true };
|
||||
sax.doAjaxRequest(sax.ajaxScorePassword, 250);
|
||||
}
|
||||
sax.onScorePassword = function (response)
|
||||
{
|
||||
var score = (response || {}).score || 0;
|
||||
sax.$prgPasswordStrength.progressbar("option", "value", score).removeClass('amber green').addClass(score > 3 ? 'green' : score > 2 ? 'amber' : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.doChangePassword = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajaxChangePassword = sax.ajaxChangePassword || { url: sax.url.base + 'Security/Ajax/StorePassword', formId: 'frmChangePassword', callbackFn: sax.onChangePassword };
|
||||
sax.doAjaxRequest(sax.ajaxChangePassword, 50);
|
||||
}
|
||||
sax.onChangePassword = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
if ($('#ifRpe').length)
|
||||
sax.goToPage('Security/Signin');
|
||||
else sax.goToPage('');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.doRequestPassword = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajaxRequestPassword = sax.ajaxRequestPassword || { url: sax.url.base + 'Security/Ajax/RequestNewPassword', formId: 'frmRequestPassword', callbackFn: sax.onRequestPassword };
|
||||
sax.doAjaxRequest(sax.ajaxRequestPassword, 50);
|
||||
}
|
||||
sax.onRequestPassword = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
var gotoSigninPage = function ()
|
||||
{
|
||||
sax.goToPage('Security/Signin');
|
||||
}
|
||||
if (response.successMsg)
|
||||
sax.doAlert($('.sax-page-caption').text(), response.successMsg, gotoSigninPage);
|
||||
else gotoSigninPage();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$(':input:enabled:visible:first').focus();
|
||||
$('#ifEmailAddress,#ifPasswordCurrent,#ifPassword,#ifPasswordConfirm').on('keydown', function () { sax.clearControlError(this); });
|
||||
$('#frmChangePassword #ifPassword').on('keyup', sax.doScorePassword);
|
||||
sax.$prgPasswordStrength = $('#frmChangePassword #prgPasswordStrength').progressbar({ 'max': 5 });
|
||||
$('#ifEmailAddress,#ifPassword', $('#frmSignIn')).on('keypress', function (e) { if (e.which == 13) sax.doSignin(); });
|
||||
$('#frmSignIn #pbSignIn').on('click', function () { sax.doSignin(); });
|
||||
$('#ifPasswordCurrent,#ifPassword,#ifPasswordConfirm', $('#frmChangePassword')).on('keypress', function (e) { if (e.which == 13) sax.doChangePassword(); });
|
||||
$('#frmChangePassword #pbChangePassword').on('click', function () { sax.doChangePassword(); });
|
||||
$('#ifEmailAddress', $('#frmRequestPassword')).on('keypress', function (e) { if (e.which == 13) sax.doRequestPassword(); });
|
||||
$('#frmRequestPassword #pbRequestPassword').on('click', function () { sax.doRequestPassword(); });
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
Reference in New Issue
Block a user