emailTokenProvider
Description
The emailTokenProvider randomly generates a 6-digit token after the user entered her correct password.
The token is then sent to the user via email. The user's attribute email is used as the recipient email address. If this attribute has not been provided by the user data provider , the login attempt fails.
The email is sent using the SMTP protocol via the smtpHost . Optionally, ssl and smptPort can be set to configure the type of connection. Optionally, smtpUser and smtpPassword can be used to use sender authentification.
The email is assembled using sender , recipient , subject and body . All of these values may contain properties in the form of ${propertyname} .
The properties will be replaced by the corresponding user attributes set by the user data provider , or token will be replaced by the numeric token value.
Can be used in
Sample
<login location="../examples/login/dialog/" path="/login/"> <staticUserDataProvider> <user username="john" password="secret" email="john@example.com"/> </staticUserDataProvider> <emailTokenProvider smtpHost="smtp.example.com" smtpPort="465" smtpUser="tokensender" smtpPassword="somepassword" sender="tokens@example.com" recipient="${email}" subject="Login System Token" body="Some test text and the token: ${token}" /> </login>
Attributes
Name | Required | Default | Description | Example |
---|---|---|---|---|
body | true | - | the email body (templated) | |
recipient | true | - | the recipient email address (templated) | |
sender | true | - | the sender email address (templated) | |
simulate | false | - | don't actually send emails, if set to true | |
smtpHost | true | - | SMTP host | |
smtpPassword | false | - | the SMTP password to use for sender authentication | |
smtpPort | false | 25 | the SMTP port to use | |
smtpUser | false | don't authenticate | SMTP user to use for sender authentication | |
ssl | false | true | whether to use SMTP over SSL | |
subject | true | - | the email subject (templated) |