Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Email factor class. More...
Public Member Functions | |
check_combination (array $combination) | |
Checks whether the factor combination is valid based on factor behaviour. | |
create_event_after_factor_setup (object $user) | |
Creates an event when user successfully setup a factor. | |
delete_factor_for_user (stdClass $user) | |
Deletes all instances of factor for a user. | |
get_active_user_factors (stdClass $user) | |
Returns an array of active user factor records. | |
get_all_user_factors (stdClass $user) | |
E-Mail Factor implementation. | |
get_display_name () | |
Returns factor name from language string. | |
get_icon () | |
Get the icon associated with this factor. | |
get_info () | |
Returns factor help from language string. | |
get_label (int $factorid) | |
Function to retrieve the label for a factorid. | |
get_lastverified (int $factorid) | |
Gets lastverified timestamp. | |
get_login_desc () | |
Get the login description associated with this factor. | |
get_no_redirect_urls () | |
Email factor implementation. | |
get_remaining_attempts () | |
Return the number of remaining attempts at this factor. | |
get_setup_string () | |
Gets the string for setup button on preferences page. | |
get_state () | |
E-Mail Factor implementation. | |
get_summary_condition () | |
Returns condition for passing factor. | |
get_weight () | |
Returns configured factor weight. | |
global_definition (\MoodleQuickForm $mform) | |
Hook point for global auth form action hooks. | |
global_definition_after_data (\MoodleQuickForm $mform) | |
Hook point for global auth form action hooks. | |
global_submit (object $data) | |
Hook point for global auth form action hooks. | |
global_validation (array $data, array $files) | |
Hook point for global auth form action hooks. | |
has_input () | |
E-Mail Factor implementation. | |
has_revoke () | |
Returns true if factor class has factor records that might be revoked. | |
has_setup () | |
Returns true if factor needs to be setup by user and has setup_form. | |
increment_lock_counter () | |
Increments the lock counter for a factor. | |
is_enabled () | |
Returns true if factor is enabled, otherwise false. | |
is_lockable () | |
Returns true if a factor is able to be locked if it fails. | |
load_locked_state () | |
This loads the locked state from the DB Base class implementation. | |
login_form_definition (\MoodleQuickForm $mform) | |
E-Mail Factor implementation. | |
login_form_definition_after_data (\MoodleQuickForm $mform) | |
E-Mail Factor implementation. | |
login_form_validation (array $data) | |
E-Mail Factor implementation. | |
possible_states (stdClass $user) | |
Email factor implementation. | |
post_pass_state () | |
Cleans up email records once MFA passed. | |
process_cancel_action () | |
Process a cancel input from a user. | |
revoke_user_factor (?int $factorid=null) | |
Marks factor record as revoked. | |
set_state (string $state) | |
Sets the state of the factor into the session. | |
setup_factor_form_definition (\MoodleQuickForm $mform) | |
Defines setup_factor form definition page for particular factor. | |
setup_factor_form_definition_after_data (\MoodleQuickForm $mform) | |
Defines setup_factor form definition page after form data has been set. | |
setup_factor_form_validation (array $data) | |
Implements setup_factor form validation for particular factor. | |
setup_user_factor (stdClass $data) | |
Setups given factor and adds it to user's active factors list. | |
show_setup_buttons () | |
If has_setup returns true, decides if the setup buttons should be shown on the preferences page. | |
update_lastverified (?int $factorid=null) | |
When validation code is correct - update lastverified field for given factor. | |
Static Public Member Functions | |
static | email_verification_code (int $instanceid) |
Sends and e-mail to user with given verification code. | |
Public Attributes | |
string | $name |
Factor name. | |
Protected Member Functions | |
obfuscate_email (string $email) | |
Obscure an email address by replacing all but the first and last character of the local part with a dot. | |
Protected Attributes | |
string | $icon = 'fa-envelope' |
Factor icon. | |
tool_mfa local secret_manager | $secretmanager |
Secret manager. | |
Email factor class.
|
inherited |
Checks whether the factor combination is valid based on factor behaviour.
E.g. a combination with nosetup and another factor is not valid, as you cannot pass nosetup with another factor.
array | $combination | array of factors that make up the combination |
bool |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_grace\factor, and factor_nosetup\factor.
|
inherited |
Creates an event when user successfully setup a factor.
object | $user |
void |
|
inherited |
Deletes all instances of factor for a user.
stdClass | $user | the user to delete for. |
void |
Implements tool_mfa\local\factor\object_factor.
|
static |
Sends and e-mail to user with given verification code.
int | $instanceid |
void |
|
inherited |
Returns an array of active user factor records.
Filters get_all_user_factors() output.
stdClass | $user | object to check against. |
array |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_grace\factor.
factor_email\factor::get_all_user_factors | ( | stdClass | $user | ) |
E-Mail Factor implementation.
stdClass | $user | the user to check against. |
array |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
inherited |
Returns factor name from language string.
Base class implementation.
string |
coding_exception |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in tool_mfa\local\factor\fallback.
|
inherited |
Get the icon associated with this factor.
string | the icon name. |
|
inherited |
Returns factor help from language string.
Base class implementation.
string |
coding_exception |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in tool_mfa\local\factor\fallback.
|
inherited |
Function to retrieve the label for a factorid.
int | $factorid |
string|dml_exception |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Gets lastverified timestamp.
int | $factorid |
int|bool | the lastverified timestamp, or false if not found. |
Implements tool_mfa\local\factor\object_factor.
factor_email\factor::get_login_desc | ( | ) |
Get the login description associated with this factor.
Override for factors that have a user input.
string | The login option. |
Reimplemented from tool_mfa\local\factor\object_factor_base.
factor_email\factor::get_no_redirect_urls | ( | ) |
Email factor implementation.
Email page must be safe to authorise session from link.
Function to get urls that should not be redirected from.
array |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
inherited |
Return the number of remaining attempts at this factor.
int | the number of attempts at this factor remaining. |
|
inherited |
Gets the string for setup button on preferences page.
string |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor, and factor_webauthn\factor.
factor_email\factor::get_state | ( | ) |
E-Mail Factor implementation.
Returns the state of the factor from session information.Implementation for factors that require input. Should be overridden in child classes with no input.
mixed |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
inherited |
Returns condition for passing factor.
Implementation for basic conditions. Override for complex conditions such as auth type.
string |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_auth\factor, factor_cohort\factor, and factor_role\factor.
|
inherited |
Returns configured factor weight.
Base class implementation.
int |
dml_exception |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Hook point for global auth form action hooks.
MoodleQuickForm | $mform | Form to inject global elements into. |
void |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Hook point for global auth form action hooks.
MoodleQuickForm | $mform | Form to inject global elements into. |
void |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Hook point for global auth form action hooks.
object | $data | Data from the form. |
void |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Hook point for global auth form action hooks.
array | $data | Data from the form. |
array | $files | Files form the form. |
array | of errors from validation. |
Implements tool_mfa\local\factor\object_factor.
factor_email\factor::has_input | ( | ) |
E-Mail Factor implementation.
Returns true if a factor requires input from the user to verify.Override in child class if necessary
bool |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
inherited |
Returns true if factor class has factor records that might be revoked.
It means that user can revoke factor record from their profile.
Override in child class if necessary.
bool |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor, and factor_webauthn\factor.
|
inherited |
Returns true if factor needs to be setup by user and has setup_form.
Override in child class if necessary.
bool |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor, and factor_webauthn\factor.
|
inherited |
Increments the lock counter for a factor.
void |
|
inherited |
Returns true if factor is enabled, otherwise false.
Base class implementation.
bool |
dml_exception |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Returns true if a factor is able to be locked if it fails.
Generally only input factors are lockable. Override in child class if necessary
bool |
|
inherited |
This loads the locked state from the DB Base class implementation.
void |
factor_email\factor::login_form_definition | ( | \MoodleQuickForm | $mform | ) |
E-Mail Factor implementation.
MoodleQuickForm | $mform |
MoodleQuickForm\$mform |
Reimplemented from tool_mfa\local\factor\object_factor_base.
factor_email\factor::login_form_definition_after_data | ( | \MoodleQuickForm | $mform | ) |
E-Mail Factor implementation.
MoodleQuickForm | $mform | Form to inject global elements into. |
object\$mform |
Reimplemented from tool_mfa\local\factor\object_factor_base.
factor_email\factor::login_form_validation | ( | array | $data | ) |
E-Mail Factor implementation.
array | $data |
array |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
protected |
Obscure an email address by replacing all but the first and last character of the local part with a dot.
So the users full email isn't displayed during login.
string | The email address to obfuscate. |
string |
coding_exception |
factor_email\factor::possible_states | ( | stdClass | $user | ) |
Email factor implementation.
stdClass | $user |
Reimplemented from tool_mfa\local\factor\object_factor_base.
factor_email\factor::post_pass_state | ( | ) |
Cleans up email records once MFA passed.
Function for factor actions in the pass state.Override in child class if necessary.
void |
Reimplemented from tool_mfa\local\factor\object_factor_base.
|
inherited |
Process a cancel input from a user.
void |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Marks factor record as revoked.
If factorid is not provided, revoke all instances of factor.
int | null | $factorid |
bool |
coding_exception | |
dml_exception |
Implements tool_mfa\local\factor\object_factor.
|
inherited |
Sets the state of the factor into the session.
Implementation for factors that require input. Should be overridden in child classes with no input.
string | $state | the state constant to set. |
bool |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_auth\factor, factor_capability\factor, factor_cohort\factor, factor_grace\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, and tool_mfa\local\factor\fallback.
|
inherited |
Defines setup_factor form definition page for particular factor.
Dummy implementation. Should be overridden in child class.
MoodleQuickForm | $mform |
object\$mform |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor, and factor_webauthn\factor.
|
inherited |
Defines setup_factor form definition page after form data has been set.
Dummy implementation. Should be overridden in child class.
MoodleQuickForm | $mform |
object\$mform |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor.
|
inherited |
Implements setup_factor form validation for particular factor.
Returns an array of errors, where array key = field id and array value = error text.
Dummy implementation. Should be overridden in child class.
array | $data |
array |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor.
|
inherited |
Setups given factor and adds it to user's active factors list.
Returns true if factor has been successfully added, otherwise false.
Dummy implementation. Should be overridden in child class.
stdClass | $data |
stdClass|null | the record if created, or null. |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor.
|
inherited |
If has_setup returns true, decides if the setup buttons should be shown on the preferences page.
bool |
Implements tool_mfa\local\factor\object_factor.
Reimplemented in factor_totp\factor, and factor_webauthn\factor.
|
inherited |
When validation code is correct - update lastverified field for given factor.
If factor id is not provided, update all factor entries for user.
int | null | $factorid |
bool|dml_exception |
dml_exception |
Implements tool_mfa\local\factor\object_factor.