Skip to content
  1. Extras
  2. ajaxLogin

ajaxLogin

Original component by Marat Marabar. Donated to the MODX community on June 13, 2023.

Main features

  • Login
  • Registration
  • Password recovery

All actions happen in a modal window; default styling uses Bootstrap 5.

Dependencies

ajaxLogin snippet

NameDefaultDescription
activationEmailTplajaxLoginActivateEmailTplChunk for the email confirmation letter (Register snippet).
activationResourceIdResource ID for email confirmation after registration (Register snippet).
emailTplajaxLoginForgotPassEmailTplChunk for the password reset email (ForgotPassword snippet).
errTplajaxLoginErrTplError output chunk for Login and ForgotPassword.
frontendCssPath to the CSS file.
frontendJsPath to the JavaScript file.
loginTplajaxLoginFormTplChunk for the login form (Login snippet).
logoutResourceIdResource ID to redirect to on logout. If empty, current resource.
registerTplajaxLoginRegisterFormTplChunk for the registration form (Register snippet).
resetResourceIdResource ID for the password reset link from email.
sentTplajaxLoginForgotPassSentTplChunk shown after requesting password reset.
tplajaxLoginForgotFormTplChunk for the password recovery form (ForgotPassword snippet).
tplAjaxajaxLoginTplChunk split in two by a separator; one part shown for logged-in users, the other for guests.
tplModalajaxLoginModalTplChunk for the modal window.
tplTypeembeddedTells Login and ForgotPassword where the form is. Not recommended to change.
submittedResourceIdRedirect to this resource after registration.

Examples

Minimal working setup:

modx
[[!ajaxLogin?
  &resetResourceId=`87`
  &emailSubject=`Password reset requested`
  &usergroups=`Users::Member`
  &activationEmailSubject=`Thanks for registering!`
  &activationResourceId=`84`
  &successMsg=`We sent a link to your email; please follow it to confirm your address.`
]]
fenom
{'!ajaxLogin' | snippet: [
  'resetResourceId' => 10,
  'emailSubject' => 'Password reset requested',
  'usergroups' => 'Users::Member',
  'activationEmailSubject' => 'Thanks for registering!',
  'activationResourceId' => 84,
  'successMsg' => 'We sent a link to your email; please follow it to confirm your address.',
]}