Add chunk: header_for_guests¶
Create a chunk that contains something like the following:
Add chunk: header_for_members¶
Next create a chunk that will be displayed to members when they are logged in:
After submitting the registration form, i get a white page¶
This issue shouldn’t come up on recent versions of MODX, but to verify this behavior, try visiting your “Request Membership” sign-up page and submit the form without any data in it. If you get nothing but a completely empty blank white page, the cause may be due to your PHP configuration.
A simple test here is the following script:
if (function_exists('mb_ereg')) {
print 'Yes, the multibyte function exists';
}
else {
print 'No, the function does not exist. The Register Snippet may fail.';
}
The solution involves recompiling PHP. You must have the mbstring library installed and you must ensure that you have not included the –disable-mbregex option.
See this forum post for more details.
Check for verification email¶
Check your email for email message containing the confirmation link. There is a section below for troubleshooting email functionality on your server.
Come again soon (5)¶
This is the page that people see after a successful logout. It needs only to contain a basic message, or perhaps a link back to the Login page:
Forgot password (2)¶
- Probably hidden from most menus
History¶
Login was written by Shaun McCormick as a login/security Extra, and first released on June 25th, 2009. It is now maintained in its fork by the MODX team.
I can’t log in!¶
Usually the errors here revolve around incorrect page IDs, misspellings of Chunk names, or omissions of square brackets in your template tags. Double-check these very carfully.
Also make sure that your Snippets are called uncached! Some of them will function cached, but some will not. They should use the exclamation point in front of them:
[[!Login]]
and not
[[Login]]
I can’t log out!¶
Another subtle error that you might encounter is an inability to log out. One cause of that is pointing your logout link to a page other than your Login page. Remember, your logout link must point to the same page containing the Login snippet!
It’s also possible that your server does not send out the Password Reset emails correctly; in that case you need to debug your email setup on your server.
Optional properties (non login)¶
Helpful parameters which can facilitate Login.
Name | Description | Default |
---|---|---|
recaptchaHeight | Can be used to modify the ReCaptcha iframe Height attribute size. | 300 |
recaptchaTheme | Can be used to modify the ReCaptcha theme to ‘red’, ‘white’, ‘blackglass’, ‘clean’, or others as they are introduced by Google. | clean |
recaptchaWidth | Can be used to modify the ReCaptcha iframe Width attribute size. | 500 |
Properties¶
Login comes with some configuration properties you can set to adjust the way Login behaves.
Testing: making it all work¶
Now that we have the pieces laid out, let’s try to make this work.
Usage¶
Example for Login:
[[!Login]]
You can also specify the template, however make sure to call the &tplType parameter also:
[[!Login? &tplType=`modChunk` &loginTpl=`myLoginChunk`]]
See the snippet properties for more options.
What is login?¶
Login is a security Extra for MODX Revolution, that allows for front-end login capabilities, as well as profile updating, registration, and forgot password functionality.
Изменение пароля
Изменение пароля будем выполнять на соответствующей странице, созданной нами в предыдущей статье.
Для этого откроем ресурс «Изменение пароля» и поместим в его содержимое форму и вызов сниппета ChangePassword. С помощью него мы будем выполнять действия, связанные с изменением пароля.
Содержимое ресурса:
Личный кабинет пользователя
На странице «Личный кабинет» будем выводить сведения из профиля пользователя, а также кнопки, с помощью которых можно перейти на страницы «Изменения пароля» и «Редактирование данных». Получение данных профиля будем выполнять через сниппет Profile.
Profile работает очень просто, он получает данные из базы и устанавливает их в соответствующие плейсхолдеры. Используя плейсхолдеры можно достаточно легко вывести необходимую информацию на странице.
Содержимое ресурса:
Обновление профиля пользователя
На странице «Редактирование данных» пользователь может изменить данные своего профиля. В данном случае: fullname (полное имя), phone (телефон), country (страна) и website (веб-сайт). Содержимое ресурса будет включать форму и сниппет UpdateProfile из пакета Login для её обработки.
Содержимое ресурса:
I never get the emails that modx sends!¶
Email configuration is unfortunately complex and differs from server to server. A good place to start is checking whether PHP can send emails. Try placing the following script on your site, then navigate to it in your browser: