mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 10:56:56 +02:00
MDL-79920 factor_sms: Improvements to the sms setup
Unlike other configurable factors, sms factor is not yet compatible with the newly introduced replace action.
This commit is contained in:
parent
dbef09ab19
commit
a64b26cb86
4 changed files with 23 additions and 24 deletions
|
@ -85,6 +85,15 @@ class factor extends object_factor_base {
|
||||||
return get_string('setupfactorbutton', 'factor_sms');
|
return get_string('setupfactorbutton', 'factor_sms');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string for manage button on preferences page.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_manage_string(): string {
|
||||||
|
return get_string('managefactorbutton', 'factor_sms');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines setup_factor form definition page for SMS Factor.
|
* Defines setup_factor form definition page for SMS Factor.
|
||||||
*
|
*
|
||||||
|
@ -349,13 +358,7 @@ class factor extends object_factor_base {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function show_setup_buttons(): bool {
|
public function show_setup_buttons(): bool {
|
||||||
global $DB, $USER;
|
return true;
|
||||||
|
|
||||||
// If there is already a factor setup, don't allow multiple (for now).
|
|
||||||
$record = $DB->get_record('tool_mfa',
|
|
||||||
['userid' => $USER->id, 'factor' => $this->name, 'secret' => '', 'revoked' => 0]);
|
|
||||||
|
|
||||||
return empty($record);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$string['action:revoke'] = 'Revoke mobile phone number';
|
$string['action:manage'] = 'Manage mobile phone number';
|
||||||
|
$string['action:revoke'] = 'Remove mobile phone number';
|
||||||
$string['addnumber'] = 'Mobile number';
|
$string['addnumber'] = 'Mobile number';
|
||||||
$string['clientnotfound'] = 'AWS service client not found. Client must be fully qualified classname e.g. \Aws\S3\S3Client.';
|
$string['clientnotfound'] = 'AWS service client not found. Client must be fully qualified classname e.g. \Aws\S3\S3Client.';
|
||||||
$string['editphonenumber'] = 'Edit phone number';
|
$string['editphonenumber'] = 'Edit phone number';
|
||||||
|
@ -35,15 +36,19 @@ $string['error:wrongphonenumber'] = 'The phone number you provided is not in a v
|
||||||
$string['error:wrongverification'] = 'Wrong code. Try again.';
|
$string['error:wrongverification'] = 'Wrong code. Try again.';
|
||||||
$string['event:smssent'] = 'SMS message sent.';
|
$string['event:smssent'] = 'SMS message sent.';
|
||||||
$string['event:smssentdescription'] = 'The user with ID {$a->userid} was sent a verification code via SMS. Information: {$a->debuginfo}';
|
$string['event:smssentdescription'] = 'The user with ID {$a->userid} was sent a verification code via SMS. Information: {$a->debuginfo}';
|
||||||
$string['info'] = '<p>Set up mobile phone to receive authentication code.</p>';
|
$string['info'] = 'Have a verification code sent to the mobile number you choose.';
|
||||||
$string['logindesc'] = 'SMS message containing a 6-digit code sent to mobile number {$a}';
|
$string['logindesc'] = 'SMS message containing a 6-digit code sent to mobile number {$a}';
|
||||||
$string['loginoption'] = 'Have a code sent to your mobile phone';
|
$string['loginoption'] = 'Have a code sent to your mobile phone';
|
||||||
$string['loginskip'] = "I didn't receive a code";
|
$string['loginskip'] = "I didn't receive a code";
|
||||||
$string['loginsubmit'] = 'Continue';
|
$string['loginsubmit'] = 'Continue';
|
||||||
|
$string['managefactor'] = 'Manage SMS';
|
||||||
|
$string['managefactorbutton'] = 'Manage';
|
||||||
|
$string['manageinfo'] = 'You are using \'{$a}\' to authenticate.';
|
||||||
$string['logintitle'] = 'Enter the verification code sent to your mobile';
|
$string['logintitle'] = 'Enter the verification code sent to your mobile';
|
||||||
$string['phonehelp'] = 'Enter your mobile number (including country code) to receive a verification code.';
|
$string['phonehelp'] = 'Enter your mobile number (including country code) to receive a verification code.';
|
||||||
$string['pluginname'] = 'SMS mobile phone';
|
$string['pluginname'] = 'SMS mobile phone';
|
||||||
$string['privacy:metadata'] = 'The SMS mobile phone factor plugin does not store any personal data.';
|
$string['privacy:metadata'] = 'The SMS mobile phone factor plugin does not store any personal data.';
|
||||||
|
$string['revokefactorconfirmation'] = 'Remove \'{$a}\' SMS?';
|
||||||
$string['settings:aws'] = 'AWS SNS';
|
$string['settings:aws'] = 'AWS SNS';
|
||||||
$string['settings:aws:key'] = 'Key';
|
$string['settings:aws:key'] = 'Key';
|
||||||
$string['settings:aws:key_help'] = 'Amazon API key credential.';
|
$string['settings:aws:key_help'] = 'Amazon API key credential.';
|
||||||
|
@ -58,10 +63,10 @@ $string['settings:countrycode_help'] = 'The calling code without the leading + a
|
||||||
See this link for a list of calling codes: {$a}';
|
See this link for a list of calling codes: {$a}';
|
||||||
$string['settings:duration'] = 'Validity duration';
|
$string['settings:duration'] = 'Validity duration';
|
||||||
$string['settings:duration_help'] = 'The period of time that the code is valid.';
|
$string['settings:duration_help'] = 'The period of time that the code is valid.';
|
||||||
$string['settings:gateway'] = 'SMS gateway';
|
$string['settings:gateway'] = 'SMS Gateway';
|
||||||
$string['settings:gateway_help'] = 'The SMS provider for sending messages via.';
|
$string['settings:gateway_help'] = 'The SMS provider you wish to send messages via';
|
||||||
$string['setupfactor'] = 'SMS setup';
|
$string['setupfactor'] = 'Set up SMS';
|
||||||
$string['setupfactorbutton'] = 'Set up SMS';
|
$string['setupfactorbutton'] = 'Set up';
|
||||||
$string['setupsubmitcode'] = 'Save';
|
$string['setupsubmitcode'] = 'Save';
|
||||||
$string['setupsubmitphone'] = 'Send code';
|
$string['setupsubmitphone'] = 'Send code';
|
||||||
$string['smsstring'] = '{$a->code} is your {$a->fullname} one-time security code.
|
$string['smsstring'] = '{$a->code} is your {$a->fullname} one-time security code.
|
||||||
|
|
|
@ -14,21 +14,12 @@ Feature: Login user with sms authentication factor
|
||||||
# Set up user SMS factor in user preferences.
|
# Set up user SMS factor in user preferences.
|
||||||
When I follow "Preferences" in the user menu
|
When I follow "Preferences" in the user menu
|
||||||
And I click on "Multi-factor authentication preferences" "link"
|
And I click on "Multi-factor authentication preferences" "link"
|
||||||
And I click on "Set up SMS" "button"
|
And I click on "Set up" "button"
|
||||||
And I set the field "Mobile number" to "+34649709233"
|
And I set the field "Mobile number" to "+34649709233"
|
||||||
And I press "Send code"
|
And I press "Send code"
|
||||||
And I set the field "Enter code" with valid code
|
And I set the field "Enter code" with valid code
|
||||||
Then I press "Save"
|
Then I press "Save"
|
||||||
|
|
||||||
Scenario: Revoke factor
|
|
||||||
Given I click on "Revoke" "link"
|
|
||||||
And I should see "Are you sure you want to revoke factor?"
|
|
||||||
And I press "Revoke"
|
|
||||||
And I should see "successfully revoked"
|
|
||||||
When I log out
|
|
||||||
And I log in as "admin"
|
|
||||||
Then I should see "Unable to authenticate"
|
|
||||||
|
|
||||||
Scenario: Login user successfully with sms verification
|
Scenario: Login user successfully with sms verification
|
||||||
Given I log out
|
Given I log out
|
||||||
And I log in as "admin"
|
And I log in as "admin"
|
||||||
|
|
|
@ -12,7 +12,7 @@ Feature: Set up SMS factor in user preferences
|
||||||
| enabled | 1 | factor_sms |
|
| enabled | 1 | factor_sms |
|
||||||
When I follow "Preferences" in the user menu
|
When I follow "Preferences" in the user menu
|
||||||
And I click on "Multi-factor authentication preferences" "link"
|
And I click on "Multi-factor authentication preferences" "link"
|
||||||
And I click on "Set up SMS" "button"
|
And I click on "Set up" "button"
|
||||||
|
|
||||||
Scenario: Phone number setup form validation
|
Scenario: Phone number setup form validation
|
||||||
Given I set the field "Mobile number" to "++5555sss"
|
Given I set the field "Mobile number" to "++5555sss"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue