MemberAuthMethodMobile
Mobile and SMS based member authentication: sign up or log in with a phone number and no password, and deliver one-time verification codes by text message. The method registers itself with the member auth method system and supplies the signup, login and forgot-password forms.
This page is a pure reference. It documents only what the module's source defines: the static functions that run the mobile auth flows, the code senders they call, and the UI forms the method exposes. For how the framework fits together, see the Guide.
MemberAuthMethodMobile- signup, login, forgot-password and code verification for the mobile method.MemberAuthMethodMobileForgotCode- build and send the forgot-password code by SMS.MemberAuthMethodMobileLoginCode- send the login code by SMS.MemberAuthMethodMobileUi- the login, signup and forgot-password forms for the mobile method.
MemberAuthMethodMobile
The main class for the mobile auth method: sign up or log in by phone number, send a verification code by SMS, verify an entered code and log the member in, and run the forgot-password flow. Functions are listed alphabetically.
CodeVerified
MemberAuthMethodMobile::CodeVerified(MemberCodeData $codeData): void
Called when a code is entered correctly: verify the member's Mobile auth record if it is not already verified, then log the member in. Sets a success status on success and an error status if anything goes wrong.
| Name | Type | Description |
|---|---|---|
$codeData | MemberCodeData | The verified code data, identifying the member. |
Returns void
ForgotPassword
MemberAuthMethodMobile::ForgotPassword(string $phoneNumber): void
Run the forgot-password flow for a phone number. For the mobile method this is the same as login: a new code is always sent.
| Name | Type | Description |
|---|---|---|
$phoneNumber | string | The member's phone number. |
Returns void
GetMessageTemplate
MemberAuthMethodMobile::GetMessageTemplate(string $codeTypeName): string
Get the configured SMS message template for a code type. Returns the verify, login or forgot template depending on the code type name, and throws for an unknown code type.
| Name | Type | Description |
|---|---|---|
$codeTypeName | string | The code type name, such as member_auth_method_mobile, member_login or member_forgot. |
Returns string The message template for the code type.
Login
MemberAuthMethodMobile::Login(string $phoneNumber, ?string $password): int
Begin a login by phone number. Throws when no member exists for the phone number; the password argument is not used for the mobile method. Returns the member id; the code is created and sent by the action handler.
| Name | Type | Description |
|---|---|---|
$phoneNumber | string | The member's phone number. |
$password | ?string | Not used for the mobile method; always null. |
Returns int The member id.
SendCode
MemberAuthMethodMobile::SendCode(int $memberId, string $codeTypeName, MemberCodeData $codeData): void
Send a verification code to a member by SMS. Reads the mobile auth record for the login number, fills the configured message template for the code type with the code, and sends it from the configured sender phone.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member to send the code to. |
$codeTypeName | string | The code type name, selecting which message template to use. |
$codeData | MemberCodeData | The code data holding the code to send. |
Returns void
Signup
MemberAuthMethodMobile::Signup(string $phoneNumber, ?string $password): int
Sign up with a phone number and no password. If a member already exists for the number, returns that member's id without error; otherwise creates a member and Mobile auth record. Returns the member id; the code is created and sent by the action handler.
| Name | Type | Description |
|---|---|---|
$phoneNumber | string | The phone number to sign up. |
$password | ?string | Not used for the mobile method; always null. |
Returns int The member id.
Verify
MemberAuthMethodMobile::Verify(MemberCodeData $codeData): void
Legacy verification entry point that delegates to CodeVerified.
| Name | Type | Description |
|---|---|---|
$codeData | MemberCodeData | The verified code data, identifying the member. |
Returns void
MemberAuthMethodMobileForgotCode
Builds and sends the forgot-password code for the mobile method. Functions are listed alphabetically.
Send
MemberAuthMethodMobileForgotCode::Send(string $phoneNumber): MemberCodeData
Get a forgot-password code from the Member module for the phone number's member and send it by SMS. Throws when no member exists for the number, so callers should not reveal whether the phone is registered. Returns the code data that was sent.
| Name | Type | Description |
|---|---|---|
$phoneNumber | string | The member's phone number. |
Returns MemberCodeData The forgot-password code data that was sent.
SendCode
MemberAuthMethodMobileForgotCode::SendCode(int $memberId, MemberCodeData $codeData): void
Send a forgot-password code to a member by SMS. Reads the mobile auth record, fills the configured forgot-password message template with the code, and sends it from the configured sender phone.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member to send the code to. |
$codeData | MemberCodeData | The code data holding the code to send. |
Returns void
MemberAuthMethodMobileLoginCode
Sends the login code for the mobile method.
SendCode
MemberAuthMethodMobileLoginCode::SendCode(int $memberId, MemberCodeData $codeData): void
Send a login code to a member by SMS. Reads the mobile auth record for the login number, fills the configured login message template with the code, and sends it from the configured sender phone.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member to send the code to. |
$codeData | MemberCodeData | The code data holding the code to send. |
Returns void
MemberAuthMethodMobileUi
The forms the mobile method exposes to the member auth method system: login, signup and forgot-password, each collecting a phone number and driving the code flow. Functions are listed alphabetically.
ForgotPasswordForm
MemberAuthMethodMobileUi::ForgotPasswordForm(): void
Render the forgot-password form: a phone number field and a submit button. On submit it validates and normalises the number, requests a reset code and redirects to the code entry page, without revealing whether the phone is registered.
Returns void
LoginForm
MemberAuthMethodMobileUi::LoginForm(): void
Render the login form: a phone number field, a submit button and a link to register. On submit it validates and normalises the number, sends a login code by SMS and redirects to the code entry page.
Returns void
SignupForm
MemberAuthMethodMobileUi::SignupForm(): void
Render the signup form: a phone number field, a submit button and a link to log in. On submit it validates and normalises the number, signs the member up, sends a login code by SMS and redirects to the code entry page.
Returns void