What is ConfirmRegister?¶
ConfirmRegister is a simple snippet that confirms a registration by a User from the Register snippet, when 'activation' in that snippet is set to 1 (the default). It is placed on a separate, "Registration Activated" page.
Register by default requires the User to activate their account before logging in. The Snippet creates the modUser object and sets its "active" field to 0. The User then gets an email with a URL to activate their account with. Once the User visits the page, their account is set to "active=1", and they can then login.
To enable this, you will need to create an Activation page by creating a new Resource, and putting this ConfirmRegister snippet inside of it:
An example Register snippet call with activation would look like this:
[[!Register? &activationEmailTpl=`myActivationEmailTpl` &activationEmailSubject=`Please activate your account!` &activationResourceId=`26` ]]
This would send the User the email specified in the "myActivationEmailTpl" chunk, with the specified subject line, which will direct the User to the Resource 26 - the Resource you put the ConfirmRegister snippet call in - to activate their account.
ConfirmRegister has some default properties packaged into it. They are:
|redirectTo||Optional. After a successful confirmation, redirect to this Resource.|
|redirectParams||Optional. A JSON object of parameters to pass when redirecting using redirectTo.|
|authenticate||Authenticate and login the user to the current context after confirming registration.||1|
|authenticateContexts||Optional. A comma-separated list of contexts to authenticate to. Defaults to the current context.|
|errorPage||Optional. If set, will redirect user to a custom error page if they try to access this page after activating their account.|
ConfirmRegister also fires the OnUserActivate plugin event after the User is activated, and passes in a 'user' parameter, which contains the newly-activated modUser object.
- Login.Using Pre and Post Hooks