forked from splittingred/Login
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Register snippet PII improvements [#130] - JSON responses for the Login controller/snippet [#121] - Use Crowdin for translations: https://crowdin.com/project/modx-login
- Loading branch information
Showing
5 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
core/components/login/docs/changelog.txt → core/components/login/docs/changelog.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
-------------------- | ||
Snippet: Login | ||
-------------------- | ||
Version: 1.9.5 | ||
Since: June 21, 2010 | ||
Author: Jason Coward <[email protected]> | ||
- Version: 1.9.6 | ||
- Since: June 21, 2010 | ||
- Author: Jason Coward <[email protected]>, | ||
Shaun McCormick <[email protected]> | ||
|
||
This component loads a simple login and logout form. It also comes packaged | ||
|
@@ -12,11 +12,15 @@ in their username or email to receive a confirmation email which will reset | |
their password. | ||
|
||
Example for Login: | ||
``` | ||
[[!Login]] | ||
``` | ||
|
||
You can also specify the template: | ||
|
||
``` | ||
[[!Login? &tpl=`myLoginChunk`]] | ||
``` | ||
|
||
See the snippet properties for more options. | ||
|
||
|
@@ -29,16 +33,21 @@ user will log in to should they click on the confirmation email, and put | |
the Reset Password snippet in. Tell it what Resource the Login snippet is | ||
in - or where you'd like it to provide a link back to: | ||
|
||
``` | ||
[[ResetPassword? &loginResourceId=`72`]] | ||
``` | ||
|
||
Then create another resource with the Forgot Password snippet, and tell it | ||
what Resource the Reset snippet is in: | ||
|
||
``` | ||
[[!ForgotPassword? &resetResourceId=`123`]] | ||
``` | ||
|
||
-------- | ||
Register | ||
-------- | ||
|
||
To use the Register snippet, simply place the Snippet in the Resource where | ||
your HTML register form is. (A default one called lgnRegisterFormTpl has | ||
been provided.). This snippet also requires Activation by the User, so they | ||
|
@@ -47,13 +56,15 @@ will get an email in their inbox regarding their signup. | |
In your form field names, you can use validation filters to validate your | ||
fields. They are separated with the colon : symbol. Example: | ||
|
||
<input type="password" name="password:required:minLength=6" id="password" | ||
value="[[+password]]" /> | ||
``` | ||
<input type="password" name="password:required:minLength=6" id="password" value="[[+password]]" /> | ||
``` | ||
|
||
will require that the password field not be empty, and have a minimum | ||
length of 6 chars. You can encapsulate validator params (6 here) with ` if | ||
the param has spaces in the name. The default validators provided are: | ||
|
||
``` | ||
required | ||
blank | ||
|
@@ -62,21 +73,26 @@ minLength=`123` | |
maxLength=`123` | ||
minValue=`123` | ||
maxValue=`123` | ||
``` | ||
|
||
You can also do custom validators by creating a Snippet and using that as | ||
the validator name. Example: We create a Snippet called 'equalTo' and | ||
on our field, we set: | ||
|
||
``` | ||
<input type="text" name="field:equalTo=`123`" id="field" /> | ||
``` | ||
|
||
Now, in our snippet, our code would look like so: | ||
|
||
``` | ||
<?php | ||
if ($scriptProperties['value'] !== $scriptProperties['param']) { | ||
return 'Value not equal to: '.$scriptProperties['param']; | ||
} | ||
return true; | ||
?> | ||
``` | ||
|
||
Returning true will make the field valid. Any other return value will | ||
be the error message. Snippets get passed the following parameters: | ||
|
@@ -87,7 +103,7 @@ be the error message. Snippets get passed the following parameters: | |
- type: The name of the validator. | ||
- validator: A reference to the lgnValidator instance. | ||
|
||
See the Snippet Properties for more options. | ||
See the Snippet Properties and the [MODX Docs](https://docs.modx.com/extras/revo/login) for more options. | ||
|
||
Thanks, | ||
Jason Coward & Shaun McCormick | ||
|