emailTokenProvider

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.


Explanation:

A token provider sending a randomly generated numeric token to the user via email.

Can be used in:

login

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

NameRequiredDefaultDescriptionExamples
smtpUser false don't authenticate
SMTP user to use for sender authentication
-
smtpHost true - SMTP host
-
sender true - the sender email address (templated)
-
subject true - the email subject (templated)
-
smtpPort false 25
the SMTP port to use
-
recipient true - the recipient email address (templated)
-
smtpPassword false - the SMTP password to use for sender authentication
-
body true - the email body (templated)
-
simulate false - don't actually send emails, if set to true
-
ssl false true
whether to use SMTP over SSL
-