Files
Saxonite/Workspace/SaxoniteCoreWebAdmin/wwwroot/js/sax-security.js
T
andy 9f22b522df v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes.

- Relocate application and library projects while retaining Git rename history.
- Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests.
- Update Common integration, application version, and repository documentation.

Application version: 1.3.0

Reviewed-on: #1
Co-authored-by: andy <andy@sarand.com>
2026-10-16 18:24:16 +01:00

93 lines
4.0 KiB
JavaScript

/*
* Admin - Security page scripts.
*/
(function (win, doc, undef)
{
"use strict";
//--------------------------------------------------------------
sax.doSignin = function ()
{
sax.clearControlErrors();
sax.ajax.signin = sax.ajax.signin || { url: sax.url.base + 'Security/Ajax/Signin', formId: 'frmSignIn', callbackFn: sax.onSignin };
sax.doAjaxRequest(sax.ajax.signin, 50);
}
sax.onSignin = function (response)
{
//sax.debug(response);
sax.refreshControlValues(response.controlValues);
if (!response.success) return;
sax.goToPage('');
}
//--------------------------------------------------------------
sax.doScorePassword = function ()
{
sax.ajax.scorePassword = sax.ajax.scorePassword || { url: sax.url.base + 'Security/Ajax/ScorePassword', formId: 'frmChangePassword', callbackFn: sax.onScorePassword, noWaitIcon: true };
sax.doAjaxRequest(sax.ajax.scorePassword, 250);
}
sax.onScorePassword = function (response)
{
var score = (response || {}).score || 0;
sax.$prgPwordStrength.progressbar("option", "value", score).removeClass('amber green').addClass(score > 3 ? 'green' : score > 2 ? 'amber' : '');
}
//--------------------------------------------------------------
sax.doChangePassword = function ()
{
sax.clearControlErrors();
sax.ajax.changePassword = sax.ajax.changePassword || { url: sax.url.base + 'Security/Ajax/StorePassword', formId: 'frmChangePassword', callbackFn: sax.onChangePassword };
sax.doAjaxRequest(sax.ajax.changePassword, 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.ajax.requestPassword = sax.ajax.requestPassword || { url: sax.url.base + 'Security/Ajax/RequestNewPassword', formId: 'frmRequestPassword', callbackFn: sax.onRequestPassword };
sax.doAjaxRequest(sax.ajax.requestPassword, 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').trigger('focus');
$('#ifEmailAddress,#ifPasswordCurrent,#ifPassword,#ifPasswordConfirm').on('input', function () { sax.clearControlError(this); });
sax.$frm.signIn = $('#frmSignIn');
sax.$frm.signIn.on('keypress', '#ifEmailAddress,#ifPassword,#chkKeepMeSignedIn', function (e) { if (e.which == 13 && $('#ifEmailAddress', sax.$frm.signIn).val() && $('#ifPassword', sax.$frm.signIn).val()) sax.doSignin(); });
sax.$frm.signIn.on('click', '#pbSignIn', function () { sax.doSignin(); }).on('keypress', '#pbSignIn', function (e) { if (e.which == 13) sax.doSignin(); });;
sax.$frm.chgPword = $('#frmChangePassword');
sax.$frm.chgPword.on('keypress', '#ifPasswordCurrent,#ifPassword,#ifPasswordConfirm', function (e) { if (e.which == 13) sax.doChangePassword(); });
sax.$frm.chgPword.on('keyup', '#ifPassword', sax.doScorePassword);
sax.$prgPwordStrength = $('#prgPasswordStrength', sax.$frm.chgPword).progressbar({ 'max': 5 });
$('#pbChangePassword', sax.$frm.chgPword).on('click', function () { sax.doChangePassword(); }).on('keypress', function (e) { if (e.which == 13) sax.doChangePassword(); });
sax.$frm.reqPword = $('#frmRequestPassword');
sax.$frm.reqPword.on('keypress', '#ifEmailAddress', function (e) { if (e.which == 13) sax.doRequestPassword(); });
$('#pbRequestPassword', sax.$frm.reqPword).on('click', function () { sax.doRequestPassword(); }).on('keypress', function (e) { if (e.which == 13) sax.doRequestPassword(); });
});
//--------------------------------------------------------------
}(window, window.document));
/* The End */