Some portal functions (such as 2FA registration) are performed by Javascript.
We offer a few custom events that let you react to certain high-level Javascript events
New in version 2.17.
Event handlers can stop the default LemonLDAP::NG behavior from executing:
$(document).on( "sslFailure", { }, function( event ) {
event.preventDefault();
// Navigate the user to the smartcard help page, etc.
});
New in version 2.0.15.
This event is triggered when a TOTP, WebAuthn or U2F device is registered
Sample code:
$(document).on( "mfaAdded", { }, function( event, info ) {
console.log( "Added MFA of type" + info.type );
// Your code here
// If you want to prevent the redirection to the 2FA register page
// event.preventDefault();
});
Changed in version 2.0.16.
New in version 2.0.15.
This event is triggered when a TOTP, WebAuthn or U2F device is removed
Sample code:
$(document).on( "mfaDeleted", { }, function( event, info ) {
console.log( "Removed MFA of type" + info.type );
// Your code here
});
New in version 2.0.16.
This even is triggered after the main portal javascript has run
Sample code:
$(document).on( "portalLoaded", { }, function( event, info ) {
// Make sure DOM is ready as well
$( document ).ready(function() {
console.log("Portal loaded and DOM ready");
});
});
New in version 2.17.
This even is triggered immediately before the user tries to authenticate using Kerberos
$(document).on( "kerberosAttempt", { }, function( event ) {
console.log( "Kerberos attempt" );
});
New in version 2.17.
This even is triggered when the user failed to authenticate using Kerberos
$(document).on( "kerberosFailure", { }, function( event , info ) {
console.log( "Kerberos failure", info );
});
New in version 2.17.
This even is triggered when before the user successfully authenticated using Kerberos
$(document).on( "kerberosSuccess", { }, function( event , info ) {
console.log( "Kerberos success", info );
});
New in version 2.17.
This even is triggered immediately before the user tries to authenticate using SSL
$(document).on( "sslAttempt", { }, function( event ) {
console.log( "SSL attempt" );
});
New in version 2.17.
This even is triggered when the user failed to authenticate using SSL
$(document).on( "sslFailure", { }, function( event , info ) {
console.log( "SSL failure", info );
});
New in version 2.17.
This even is triggered when before the user successfully authenticated using SSL
$(document).on( "sslSuccess", { }, function( event , info ) {
console.log( "SSL success", info );
});
New in version 2.17.
This even is triggered immediately before the user tries to use a WebAuthn device
$(document).on( "webauthnAttempt", { }, function( event ) {
console.log( "WebAuthn attempt" );
});
New in version 2.17.
This even is triggered when the user failed to use a WebAuthn device
$(document).on( "webauthnFailure", { }, function( event , info ) {
console.log( "WebAuthn failure", info );
});
New in version 2.17.
This even is triggered when the user successfully used a WebAuthn device
$(document).on( "webauthnSuccess", { }, function( event , info ) {
console.log( "WebAuthn success", info );
});
New in version 2.17.
This even is triggered immediately before the user tries to register a WebAuthn device
$(document).on( "webauthnRegistrationAttempt", { }, function( event ) {
console.log( "WebAuthn registration attempt" );
});
New in version 2.17.
This even is triggered when the user failed to register a WebAuthn device
$(document).on( "webauthnRegistrationFailure", { }, function( event , info ) {
console.log( "WebAuthn registration failure", info );
});
New in version 2.17.
This even is triggered when the user successfully registered a WebAuthn device
$(document).on( "webauthnRegistrationSuccess", { }, function( event , info ) {
console.log( "WebAuthn registration success", info );
});
New in version 2.18.
This event is triggered on every keystroke while the user inputs a new password. You can use it to check if it fits certain criteria.
You can fetch the candidate password in context.password.
context.evType will contain focusout if the user has focused out of the password field. You can use it for costly password quality checks to avoid running the check at every keystroke.
context.setResult is a function that you can call to update the password form state.
The new password form can only be submitted when all policies have been set to a status of either good or info.
$(document).on( "checkpassword", function( event , context ) {
password = context.password;
evType = context.evType;
setResult = context.setResult;
// Do your client-side check here
setResult("my-custom-ppolicy", "bad");
});