← API Index · How to use components

logon component #oo-logon

The component implements the logon screen and the logout query.

How components are mounted, how switch values are resolved and how debug output is enabled is described in the use-js-components skill.

<div id="oo-flash"></div>
<div id="oo-logon" data-oo-loggedon-page="index.html" data-oo-loggedout-page="index.html"></div>

This example changes the page after a successful logon or logout. The flash component is used to display possible errors. As the page changes after the action, the target pages should also (as any page) have a flash component.

component switches

Page switches

Switch Default Description
oo-loggedon-page – A successful logon redirects to that page.
oo-loggedon-target – Optional window target (e.g. _blank) for the page change after a successful logon.
oo-loggedout-page – A successful logout redirects to that page.
oo-register-page – Page with the new customer registration (profile component); target in email-first mode if the e-mail is unknown, and of the "register" link.
oo-cart-page oo-loggedon-page Page hosting the cart component. Target of .oo-logon-cartlink elements, and used instead of oo-loggedon-page after a logon if there is already an open order for the selected date, or if the shop's new customer item was just added to the cart of a first-time customer.
oo-profile-page oo-loggedon-page Page hosting the profile component; used instead of oo-loggedon-page after an employee logon (user id starting with -).

Behaviour switches

Switch Default Description
oo-logonmode – Logon form variant. email1st: the e-mail (or customer number) is requested first; depending on its existence in the customer database, submitting continues to a logon form (adding the password field) or switches to the register page. email1stpw: as email1st, but if the e-mail exists and no password is assigned yet (typical after a migration), a password is generated and mailed ("We just generated a password…"). name: old style name logon; needs the corresponding backend setting that allows the name as logon value. Note: no dash in the name — this is a global option shared with the profile component. Best set globally.
oo-logon-mode – Legacy. email1st is still honoured as an alias of oo-logonmode=email1st.
oo-skip-locate false true implies the new customer tour; no location gathering requests and interactions are done and the "located" info is removed. See also the profile component.
oo-cartmode order cart: the cart is cleared right after logon; a possibly existing order for the next date is not offered for re-editing, instead a new empty order (for the next possible delivery day) is prepared. order: show the order if one exists. Works on the cart component too. Best set globally.

States

The component is rendered differently in three states:

State Description
Authenticated Offers the logout option. If the cart holds unsent changes, a warning must be confirmed before the logout button is enabled.
Anonymous Offers links to the locating process and the logon options.
Located The visitor's location is already known. Offers logon options and a link to the registration or a re-evaluation of the location.

debug options

Debug scope logon (enable with data-oo-debug="true" on the element or debug:logon:<term>+, see the skill):

Term Description
logon:all General debug output (resolved mode and switches, form variant shown, logon / email-first attempts, page changes).