Appearance
User Registration & Verification β
Step-by-step for user sign-up and email verification using Basic Authentication.
This workflow covers creating a user account with email/password and verifying the email address before allowing login.
Prerequisites β
- Users table in the helper file with fields for:
email,passwordHash,isVerified,isEnabled, and timestamps - Email delivery configured in
onAuthNotifier(server-side) for verification messages
Workflow β
- User submits the registration form
- Run
authRegisteraction. The sign-up page model, form, pages, and URL query go with that request.passwordandpassword2are removed. onBeforeRegistrationruns, then the user record is created (password stored as a one-way hash)onAuthNotifiersends the verification email. That call includesdata.modelfrom the sign-up form.onRegistrationruns in the same request.data.useris the new user record (idandrecid). The helper replacesdata.userwithui_Users::asJSONbefore your hook script runs.- User clicks the link and lands on a verification page
- Run
authVerifyaction on page load to confirm the token - Mark the user record as verified (
isVerified = True) - Optionally sign the user in or redirect to login
Page Actions β
- Registration page:
authRegister - Verification page:
authVerify(recommended to run in an onFormLoad named action) - Optional resend-verification UI:
authResend(requiresemail)
Hooks (FileMaker) β
onBeforeRegistration: optional gate before the user is created β returnmodel.createUser = falseto reject the signuponRegistration: runs after the user exists, in the same sign-up request.data.useris the new row (id,recid).data.modelis the sign-up page model without passwords. Returned actions continue the sign-up thread; no actions sends the browser to/dash.onAuthNotifier: sends the verification email. The email sent during sign-up includesdata.model.authResenddoes not.
Controlling Who Can Sign Up β
Use onBeforeRegistration when you want FileMaker rules to approve or reject a signup before the Users record is created.
Examples:
- allow only
@yourcompany.comaddresses - require a pre-approved invite or matching contact record
- block self-service signup for locked-down apps (
createUser = false)
For password registration (authRegister):
model.createUser = trueβ registration continuesmodel.createUseris nottrueβ registration is rejected- hook missing (older helpers) β registration still continues, so existing apps are not broken
When the hook rejects the signup, the Klai Sign Up page shows this error after Create Account:
User not authorized to register.
OAuth new-user creation uses the same hook but is stricter: missing hook or no explicit allow blocks account creation. See onBeforeRegistration and OAuth.
After a user is created, helper Auto Enable User Accounts still controls whether they can sign in (isEnabled). Use Auto Enable for βcreate but inactiveβ; use onBeforeRegistration when the account should not be created at all.
Data Considerations β
- Verification tokens should be treated as secrets; avoid logging or storing them in cleartext
- Verification tokens should be time-bound and single-use
Practical Notes β
- Registration pages must provide
emailandpasswordin the page model before runningauthRegister - If you want a second "confirm password" field, use a custom validator to compare
passwordandpassword2 - Authentication feedback can be shown with
model.authMessage, or more robustly withmodel.authMessageCodeandmodel.authMessageType - Verification pages usually run
authVerifyautomatically inonFormLoad - The verification action reads the token from the URL; you generally do not need to parse it manually
- Users must still be enabled (
isEnabled = true) to sign in after verification