Login - MODX Community Forums https://forums.modx.com/board/?board=78 <![CDATA[Not Redirecting to Login Form]]> https://forums.modx.com/thread/104915/not-redirecting-to-login-form#dis-post-564145 Login 1.9.7

On one site I have a simple login form with a few protected pages in the Web (web) context. If someone (not signed-in) tries to access one of the protected pages without first signing-in they are automatically redirected to the login form as I would expect. They do not get a 404.

But on a different site I have another login form, this time in a different context Test (test). When someone (not signed-in) tries to access a protected page they are not redirected to the login page but instead get a 404. I'm not necessarily saying the different contexts are the reason but I have no idea what's causing it.

Can anyone shed some light?

https://forums.modx.com/thread/104915/not-redirecting-to-login-form#dis-post-564145 Tue, 19 Feb 2019 08:08:52 +0000 https://forums.modx.com/thread/104915/not-redirecting-to-login-form#dis-post-564145
<![CDATA[Forgot Password not resetting the password]]> https://forums.modx.com/thread/90993/forgot-password-not-resetting-the-password#dis-post-563511
I have the Login snippet set up according to the docs and all seems to run ok, except for the Forgot Password.

Here are the snippet calls in my pages:

The Forgot Password page (id 7):
[[!ForgotPassword? &resetResourceId=`8` &tpl=`lgnForgotPassTpl`]]

Reset Password Handler page (id 8 ):
[[!ResetPassword? &loginResourceId=`6`]]

Login page (id 6);
[[!Login? &loginTpl=`lgnLoginTpl2`

The password reset email arrives at the correct address and looks like:

To activate your new password, please click on the following link:


If successful you can use the following password to login:

Password: 761pwqsf

If you did not request this message, please ignore it.

Site Administrator
(Note the link here is to the handler, not the login page. Is this correct?)

If I click on the link I arrive at the default (Home) page. I click through to the login page (id 6) and try to login with the new password, but it fails with the following message:
The username or password you entered is incorrect. Please check the username, re-type the password, and try again.

I had a look in my database before and after password resets and nothing appears to change (modx_users table). (The original password still works and I can login with that, so def no change in the db).

In my error log, the only entries which may be related to this issue are:
[2014-05-21 09:19:29] (INFO @ /mydomain/index.php) Principal 0 does not have permission to load object of class modDocument with primary key: 9
[2014-05-21 09:19:29] (INFO @ /mydomain/index.php) Principal 0 does not have permission to load object of class modDocument with primary key: 25
[2014-05-21 09:19:29] (INFO @ /mydomain/index.php) Principal 0 does not have permission to load object of class modDocument with primary key: 26
[2014-05-21 09:19:29] (INFO @ /mydomain/index.php) Principal 0 does not have permission to load object of class modDocument with primary key: 5
[2014-05-21 09:19:29] (INFO @ /mydomain/index.php) Principal 0 does not have permission to load object of class modDocument with primary key: 5
(The id of the user is 5, in the modx_users table. Nor sure where the ids 25 and 26 apply to)

I see that there was a bug related to this issue reported back in (http://bugs.modx.com/issues/6658), although my error messages are different, but there is no indication as to whether it has been worked on or fixed.

Any suggestions as to a cause and cure to make my passwords reset?]]>
https://forums.modx.com/thread/90993/forgot-password-not-resetting-the-password#dis-post-563511 Thu, 10 Jan 2019 12:28:56 +0000 https://forums.modx.com/thread/90993/forgot-password-not-resetting-the-password#dis-post-563511
<![CDATA[Login preHooks setValue]]> https://forums.modx.com/thread/97529/login-prehooks-setvalue#dis-post-562979 I can't make works a setValue by using a preHooks.

[[!Login? &tplType=`modChunk` &loginTpl=`PortfolioLoginTpl` &preHooks=`error_login`]]

<div class="collapse" id="login" style="[[+show]]">
        <div class="loginForm">
            <div class="loginMessage">[[+errors]]</div>
            <div class="loginLogin">
                <form class="loginLoginForm  form-inline" action="[[~[[*id]]]]" method="post">

if ($modx->user->isAuthenticated('web') == false)
    $show = 'display: block';
else $show = 'display: none';

$hook->setValue('show',$show); // placeholder doesn't get any value in tpl
$hook->setValues(array('show' => $show)); // tried with array

return true;

I'm tried to playing with prefix login, doesn't help.

MODX 2.3.3
Login 1.9.0
PHP 5.4.39]]>
https://forums.modx.com/thread/97529/login-prehooks-setvalue#dis-post-562979 Wed, 28 Nov 2018 10:53:52 +0000 https://forums.modx.com/thread/97529/login-prehooks-setvalue#dis-post-562979
<![CDATA[&redirectToPrior always redirects to the homepage]]> https://forums.modx.com/thread/69967/redirecttoprior-always-redirects-to-the-homepage?page=4#dis-post-562929
I can't get the login to redirect to the prior page. Maybe a bug??]]>
https://forums.modx.com/thread/69967/redirecttoprior-always-redirects-to-the-homepage?page=4#dis-post-562929 Mon, 26 Nov 2018 09:10:30 +0000 https://forums.modx.com/thread/69967/redirecttoprior-always-redirects-to-the-homepage?page=4#dis-post-562929
<![CDATA[How to have user extended fields available at each creation ?]]> https://forums.modx.com/thread/44917/how-to-have-user-extended-fields-available-at-each-creation?page=4#dis-post-561599
I would like to know if it’s possible to have a list of extended fields available each time I create a new user, like an event who create this extended fields for me, or any solution.

https://forums.modx.com/thread/44917/how-to-have-user-extended-fields-available-at-each-creation?page=4#dis-post-561599 Tue, 18 Sep 2018 01:07:34 +0000 https://forums.modx.com/thread/44917/how-to-have-user-extended-fields-available-at-each-creation?page=4#dis-post-561599
<![CDATA[Login and RecaptchaV2 - Logout not possible]]> https://forums.modx.com/thread/103963/login-and-recaptchav2---logout-not-possible#dis-post-559161
I'm using MODX Revolution 2.6.4-pl and the Login Snippet in combination with the RecaptchaV2 snippet. The Login-Chunk is in right sidebar and always visible.

After activation of the recaptcha it's not possible to logout. I'm getting always this error: Please select the checkbox in the ReCaptcha image.

If I delete the &preHooks Parameter in the snippet call, the I can logout.

What could be wrong?

Best regards
https://forums.modx.com/thread/103963/login-and-recaptchav2---logout-not-possible#dis-post-559161 Thu, 21 Jun 2018 05:15:12 +0000 https://forums.modx.com/thread/103963/login-and-recaptchav2---logout-not-possible#dis-post-559161
<![CDATA[ [solved] Login with multiple contexts]]> https://forums.modx.com/thread/79375/solved-login-with-multiple-contexts?page=2#dis-post-559085
I am working with 2 contexts: web & it
so the websites are

The user can do a login in both languages.

But i still have 1 major issue:
- The personalise snippet doesn't work in the 'it' context despite i have added the following
to my login snippet


I need to fill in the logged in user as a field in a custom table and i am using the value of
but this gives me null in the IT context.

Please can somebody help, because this is one of the last issues before this site can go live...]]>
https://forums.modx.com/thread/79375/solved-login-with-multiple-contexts?page=2#dis-post-559085 Thu, 14 Jun 2018 09:37:44 +0000 https://forums.modx.com/thread/79375/solved-login-with-multiple-contexts?page=2#dis-post-559085
<![CDATA[Update Username]]> https://forums.modx.com/thread/103843/update-username?page=2#dis-post-558577
I included the username field in the UpdateProfile form but changes are not being saved. No errors, the value just stays the same. Works fine when editing in the Manager Menu > Users > User.

<form action="[[~[[*id]]]]" method="post">
    [[+login.update_success:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]

    <label for="username">[[!%login.username]] [[!+error.username]]</label>
    <input type="text" name="username" id="username" value="[[+username]]">
https://forums.modx.com/thread/103843/update-username?page=2#dis-post-558577 Tue, 15 May 2018 04:53:05 +0000 https://forums.modx.com/thread/103843/update-username?page=2#dis-post-558577
<![CDATA[Success Message]]> https://forums.modx.com/thread/103845/success-message#dis-post-558531
What's the trick to getting the Update Profile form to display a success message? I can't get anything to render. It seems the message configuration is different from say, FormIt.]]>
https://forums.modx.com/thread/103845/success-message#dis-post-558531 Sun, 13 May 2018 09:39:35 +0000 https://forums.modx.com/thread/103845/success-message#dis-post-558531
<![CDATA[Cross-Form Validation Error]]> https://forums.modx.com/thread/103800/cross-form-validation-error#dis-post-558280
I have a page that contains both the UpdateProfile and FormIt forms. The profile form is in a template and the FormIt form is called in a Chunk. They both work, essentially.

Recently I noticed that when the FormIt form throws a validation error for an empty field it also throws the same error in the UpdateProfile form for all the required fields despite those fields being populated. When reversed, any errors in the UpdateProfile form does not throw errors in the FormIt form.

<form id="profile-message" class="editProfile" action="[[~[[*id]]]]#profile-message" method="post">
    [[+login.update_success:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]
    <input type="hidden" name="nospam:blank" value="">
    <input type="hidden" name="fullname" id="fullname" value="[[!+firstName]] [[!+lastName]]">
    <input type="hidden" name="mediaFolder" id="mediaFolder" value="[[!+mediaFolder]]">
        <legend>Edit Profile</legend>
        <label for="firstName">First Name [[!+error.firstName]]</label>
        <input type="text" name="firstName" id="firstName" value="[[+firstName]]">
        <label for="lastName">Last Name [[!+error.lastName]]</label>
        <input type="text" name="lastName" id="lastName" value="[[+lastName]]">
        <label for="email">Registration [[!%login.email]] [[!+error.email]]</label>
        <input type="text" name="email" id="email" value="[[+email]]">

        <label for="screenName">Screen Name [[!+error.screenName]]</label>
        <input type="text" name="screenName" id="screenName" value="[[+screenName]]">
    <input type="submit" name="login-updprof-btn" class="button" value="[[!%login.update_profile]]">

<span id="contact-message" class="message">[[+fi.successMessage]]</span>
<form id="contactForm" class="contactForm" name="Contact" action="[[~[[*id]]]] method="post">
        <label for="name">Name [[!+fi.error.name]]</label>
        <input type="text" name="name" id="name" value="[[!+fi.name]]" tabindex="1">

        <label for="email">Email [[!+fi.error.email]]</label>
        <input type="email" name="email" id="email" value="[[!+fi.email]]" tabindex="2">
        <input type="email" name="confirmemail" value="[[+fi.confirmemail]]" class="confirmemail" autocomplete="off" placeholder="">

        <label for="message">Message [[!+fi.error.message]]</label>
        <textarea name="message" id="message" rows="5" value="[[!+fi.message]]" tabindex="3">[[!+fi.message]]</textarea>
        <input type="submit" name="contactSubmit" class="button" value="Go">
https://forums.modx.com/thread/103800/cross-form-validation-error#dis-post-558280 Sun, 29 Apr 2018 06:32:52 +0000 https://forums.modx.com/thread/103800/cross-form-validation-error#dis-post-558280
<![CDATA[Update Profile Validation]]> https://forums.modx.com/thread/103770/update-profile-validation#dis-post-558258 Login 1.9.5

I have a ClassExtender field (screenName) that requires a minimum of three characters which correctly throws an error if less than three. The problem is the form still submits and the field is updated despite the error.

<label for="screenName">Screen Name [[!+error.screenName]]</label>
<input type="text" name="screenName" id="screenName" value="[[+screenName]]">
https://forums.modx.com/thread/103770/update-profile-validation#dis-post-558258 Fri, 27 Apr 2018 10:10:10 +0000 https://forums.modx.com/thread/103770/update-profile-validation#dis-post-558258
<![CDATA[Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-558000
I used ClassExtender to create several new User Profile fields, and as I understand it that requires adding the following two properties to the Register call:

Am I correct that "useExtended=0" prevents extended fields from being added to the "Extended" tab of the user profile page? Because as far as I can tell that seems to be exactly what's happening when someone registers.]]>
https://forums.modx.com/thread/103727/register-and-classextender#dis-post-558000 Fri, 13 Apr 2018 05:03:49 +0000 https://forums.modx.com/thread/103727/register-and-classextender#dis-post-558000
<![CDATA[Check Extended Field for Duplicates]]> https://forums.modx.com/thread/103712/check-extended-field-for-duplicates#dis-post-557917
I found this thread https://forums.modx.com/thread/101939/use-getobject-to-check-existing-data and was curious if it would work for an extended (ClassExtender) field ("screenName") to check if the same value already exists?]]>
https://forums.modx.com/thread/103712/check-extended-field-for-duplicates#dis-post-557917 Wed, 11 Apr 2018 06:33:45 +0000 https://forums.modx.com/thread/103712/check-extended-field-for-duplicates#dis-post-557917
<![CDATA[Fullname vs. First and Last]]> https://forums.modx.com/thread/103706/fullname-vs-first-and-last#dis-post-557900
On my registration form I chose to disable the default "fullname" field and replace it with "first" and "last" name fields instead. It works fine.

With regard to managing users from the Manager the "fullname" field is obviously quite useful so I'm wondering if there's a way to grab and combine the "first" and "last" name values from the Registration form and use them as the value for the "fullname" field.

I realize I could display the "first" and "last" names as extended fields on the user Manager page but if possible I would prefer to make use of the "fullname" field since it's already there.]]>
https://forums.modx.com/thread/103706/fullname-vs-first-and-last#dis-post-557900 Tue, 10 Apr 2018 08:13:46 +0000 https://forums.modx.com/thread/103706/fullname-vs-first-and-last#dis-post-557900
<![CDATA[ClassExtender]]> https://forums.modx.com/thread/103707/classextender#dis-post-557866 ClassExtender 2.1.0
Login 1.9.5

I'm using several extended fields with UpdateProfile,

I also ran Extend modUser so all the extended fields are represented in the Manager User Profile page. So far so good.

Updating the profile from the front-end seems to be working fine (so far) with all the extended fields. Everything gets written/updated to the db and Manager page. The two exceptions are the default "website" and "username" fields.

I added the "website" and "username" fields to the profile form,
<label for="username">Username [[+error.username]]</label>
<input type="text" name="username" id="username" value="[[+username]]">

<label for="website">Website [[+error.website]]</label>
<input type="text" name="website" id="website" value="[[+website]]">

with the placeholders:
Username: [[+username]]

Website: [[+website]]

The problem is both fields revert back to their previous value on save.

Because these are default user fields (i.e. not extended) I assumed it didn't need to be included in Extend modUser.]]>
https://forums.modx.com/thread/103707/classextender#dis-post-557866 Mon, 09 Apr 2018 07:51:15 +0000 https://forums.modx.com/thread/103707/classextender#dis-post-557866
<![CDATA[Append Class]]> https://forums.modx.com/thread/103201/append-class#dis-post-555410
I know how to add/remove classes using js but I don't know how to do it based soley on whether someone is signed-in or not.]]>
https://forums.modx.com/thread/103201/append-class#dis-post-555410 Tue, 21 Nov 2017 11:29:05 +0000 https://forums.modx.com/thread/103201/append-class#dis-post-555410
<![CDATA[freshly created Register page is not found]]> https://forums.modx.com/thread/103158/freshly-created-register-page-is-not-found#dis-post-555180
I'm heading back to the Login package (1.9.4-pl2) for our running site 2.5.6-pl.
Snippet Login is used since the begin in a dual context environment ('web' -French default - and 'eng' - well.. english side).

No issue until now.

I need now to add Register abilities.

Reading the doc for register (i.e : https://docs.modx.com/extras/revo/login/login.register/register.example-form-1)

I built under the Login resource page, the Register page itself that is intended to be called by clicking on a link from the Login page for any visitor who wants to create an online account.
An activation page targeted by the action email link
A post registering page saying an email has been sent ...

Before being on the hard part (customs fields, probable email issues...)

I'm not able to display my register page > 404 trying to see the web context register page (right click/see menu) we fall into the 404 eng context page !!
Trying to see the register page from the ENG context then the english register page is loaded ok.

No idea why (published of course but not menu visible.
I created the ENG one too (Babel) and it's the same !%%$ pb.

Any idea?
thank you

This register page contains
   &activationEmailSubject=`Activation de votre compte`


https://forums.modx.com/thread/103158/freshly-created-register-page-is-not-found#dis-post-555180 Wed, 15 Nov 2017 09:39:04 +0000 https://forums.modx.com/thread/103158/freshly-created-register-page-is-not-found#dis-post-555180
<![CDATA[multiple context login]]> https://forums.modx.com/thread/83395/multiple-context-login#dis-post-553986
Today I would like to share with you the outcomes of my, rather simple solution, of multiple contexts and login which automatically logs user in to all of them, no matter which one of the is used to log in.

The contexts are web and pl, where each of them have own translations handled by Babel.

Here's what I did to make the login work for all of the contexts:

I tried using placeholder in Login call &contexts=`pl,web`
I checked users and their user groups, both users and their respective user groups have access to all contexts and its resources
I tried assigning postHook to Login which would log in user to all contexts as suggested by Bob in this http://forums.modx.com/thread/82028/allowing-member-access-to-multiple-contexts post
I also tried changing session_cookie_path to "/" as mentioned in this post http://forums.modx.com/thread/?thread=79375&page=2
I cleared the cache, flushed permissions and flushed sessions every time a change has been made

Only postHook worked for me but since it has been applied, the redirection after login does not work...
It logs in user properly but refreshes the same page instead of performing redirect

I'm out of ideas at the moment so maybe someone here knows what may be causing this behaviour?

https://forums.modx.com/thread/83395/multiple-context-login#dis-post-553986 Tue, 19 Sep 2017 09:33:36 +0000 https://forums.modx.com/thread/83395/multiple-context-login#dis-post-553986
<![CDATA[reg.error.message not working]]> https://forums.modx.com/thread/93000/reg-error-message-not-working#dis-post-553226
Sorry to bother you people again with this new thread, but I need to get this working. Although I posted this question already in another old thread I open this new one to have an adequate topic and in hope to get a hint.

I'm using MODx 2.2.15 with the Login-Package 1.8.1, which finally after lot of researching seems to be working fine - except one thing (for now)!

By using the Login.Register-snippet I'm not able to get any output off the "reg.error.message"-placeholder.

I'm using this register-call:

    &activationEmailSubject=`Vielen Dank für Ihre Registrierung!`

and inbetween my html-part I use this as the placeholder for the general-error-message:


But this doesn't contain anything, even if I try to submit the form with blank input-fields.

I also tried different variations of the placeholder, but none worked for me:


When I'm using the different error-placeholders for the several input fields, I get the desired output when the validation of this input-field fails:


But I need the general-error-message to be checked if it is empty. When it's not empty I want to show a div in a lightbox-way in cojunction with some javascript, which holds the error messages likes this:

<div class="lightbox-error-message">

This works fine for the login-snippet, as well as for any other snippet within the login-package, except this register-snippet.

So how do I get the reg.error.message-placeholder working?]]>
https://forums.modx.com/thread/93000/reg-error-message-not-working#dis-post-553226 Fri, 18 Aug 2017 01:11:59 +0000 https://forums.modx.com/thread/93000/reg-error-message-not-working#dis-post-553226
<![CDATA[Customize the appearance of the Login page / fields.]]> https://forums.modx.com/thread/102087/customize-the-appearance-of-the-login-page-fields#dis-post-550450
When I view the lgnlogintpl.chunk.tpl, I see that there are some CSS styles identified (ex. div class="loginForm") but I do not know where the corresponding CSS lives. Perhaps I need to actually define those styles myself in the CSS that I assign to the template that will drive the login / logout pages?

Any direction on all of this would be greatly appreciated. Thanks.

https://forums.modx.com/thread/102087/customize-the-appearance-of-the-login-page-fields#dis-post-550450 Thu, 04 May 2017 03:33:43 +0000 https://forums.modx.com/thread/102087/customize-the-appearance-of-the-login-page-fields#dis-post-550450