Skip to main content
With login by email, a buyer logs in without a password. They enter their email address on the login page. The shop then sends them an email. The content of this email logs them in. Depending on the configuration, the email contains either a one-time code that the buyer must enter in the shop, or a login link that completes the login directly when clicked. The EOL- tags control both sides of this flow: the login page with request and code entry, and the email with the code or link. In addition, there are two button tags and one form tag that are only used in this context and are therefore described here. Guide: Login by email without a password · Reference: EmailOTPLogin section

Where the tags apply

The entire flow in the shop runs through a single template, namely the login template from the Templates section of the shop configuration (ws_login.htm). The shop system displays this template in three situations: as the normal login page, after an email has been requested, and after an error. The template itself decides which view is displayed based on the value of EOL-PendingEmail. The email is created from a separate template that is entered in the EmailOTPLoginMail section. Only there are EOL-Code and EOL-MagicLink filled. All other EOL- tags are active in both templates.

Is the function enabled

EOL-Enabled takes test operation into account. If the configuration contains allow = test, the bracketing only applies in the shop’s test mode. This lets you build the function in the live shop without it being visible to buyers. EOL-MethodIsCode and EOL-MethodIsLink only read the Method setting and do not check whether the function is enabled. Therefore, always use them within EOL-Enabled. All three tags are pure bracketings, both positive and negative.

Request or code entry: EOL-PendingEmail

When a buyer has requested an email, the shop remembers the entered address in the session. EOL-PendingEmail outputs it as a single tag and serves as a bracketing as long as it is present. The template uses this to switch between the two views.
The shop sets the address even if no customer account exists for it. In this case, no email is sent, but the same view is displayed. Visitors therefore cannot tell which addresses are registered in the shop. The address is removed again when the login succeeds, the buyer cancels the process, sending the email fails, the validity period since the request has expired, or the login is locked due to too many failed attempts. In this case, the template automatically falls back to the request view.

Form fields and buttons

The request does not need its own form tag. It runs via the normal login form FORM-LoginKnownUser. Only the code entry has its own target with FORM-EOL_Verify.
BT-EOL_Request only outputs something if the function is active and the login template is displayed. On any other template, and when the function is disabled, the name attribute remains empty and the button does not trigger any action.
Put the request field in a separate form and not in the existing form with address and password. Both forms may have the same target FORM-LoginKnownUser. If the password form contains a required field for login by email, the browser prevents the normal login as long as the field is empty.
Clicking the “Cancel” button deletes the remembered address and returns the buyer to the login page. Because it is in the same form as the code field, it needs the formnovalidate attribute. Otherwise, the browser first requires a code before it submits the cancellation at all.
The button for submitting the code entry does not need a name. The target FORM-EOL_Verify is enough for the shop to know what to do.
The shop compares the code character by character, without removing spaces and without normalizing upper and lower case. With CodeAlphabet = alphanumeric, the code consists of uppercase letters and digits. Anyone who types it in lowercase gets error 3. In this case, replace inputmode="numeric" with autocapitalize="characters" and point out the capitalization in the text. No tag tells the template which alphabet is set; you need to know the configuration.

Content of the email

Both EOL-Code and EOL-MagicLink are only filled while the email is being created. Afterwards, the shop deletes the code and the link from memory and only keeps a check value. On the login page, both tags therefore return nothing and cannot be used as a bracketing either. EOL-MagicLink is an absolute HTTPS address without a session ID. The buyer can therefore open the link on a different device than the one on which they requested the email. The login then takes place on the device on which they click. If MagicLinkBindIP = yes is set in the configuration, this only works if both devices access the internet with the same IP address. Otherwise, error message 5 appears. The fields EOL-CodeLength and EOL-ValidityMinutes output the value actually used. A value outside the permitted range has already been pulled to the limit. Both always apply as a bracketing.

Displaying errors

There is a separate error tag for the request and for the check. As a single tag, it outputs the error number. As a bracketing without a parameter, it applies as soon as the number is not 0. With a parameter, it applies for exactly this number.

EOL-RequestError

Error 5 also occurs if no template is entered in the EmailOTPLoginMail section. It is therefore the typical error of an incomplete setup.

EOL-VerifyError

For errors 3 and 4, the following view depends on the method. After an incorrect code entry, the buyer stays in the code entry form. After an invalid link, they end up in the request view, often on a device on which there is no remembered address at all.
Therefore, place the output of EOL-VerifyError outside the EOL-PendingEmail bracketing. Errors 1, 5, and 200 to 203, the lock due to failed attempts, and any error when opening a link appear in the request view. Within {EOL-PendingEmail}, they would remain invisible.
For request errors 4 to 6, the shop often also sets EOL-VerifyError to 1, because no valid request was created. In this case, only the request error should be displayed, because otherwise the buyer sees two messages for the same problem.
An error number only applies to the request in which it occurs. On the next page request, both tags are reset to 0.

After a successful check

If the code or link is correct, the shop logs the buyer in. A new session ID is assigned, the counter for failed attempts is reset, and the time of the last login is recorded. If the buyer has set up two-factor login, they do not go directly to the customer account afterwards.

The tags at a glance

Related topics