Skip to content

Commit

Permalink
fixup! MDL-81924 core_sms: Add SMS gateway management UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhawkins committed Sep 12, 2024
1 parent c14292f commit e93bbc3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
12 changes: 11 additions & 1 deletion admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ Feature: Login user with sms authentication factor

Background:
Given I log in as "admin"
And the following "core_sms > sms_gateways" exist:
| name | classname | enabled | config |
| Dummy gateway | smsgateway_aws\gateway | 1 | {"countrycode":"+61", "gateway":"aws_sns", "api_region":"ap-southeast-2", "api_key":"abc", "api_secret":"123"} |
And the following config values are set as admin:
| enabled | 1 | tool_mfa |
| lockout | 3 | tool_mfa |
And the following config values are set as admin:
| enabled | 1 | factor_sms |
| enabled | 1 | factor_sms |
| weight | 100 | factor_sms |
| duration | 1800 | factor_sms |
And I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration
And I follow "Edit settings for the SMS mobile phone factor"
And I set the field "SMS gateway" to "Dummy gateway (AWS)"
And I press "Save changes"
And I should see "Changes saved"
# Set up user SMS factor in user preferences.
When I follow "Preferences" in the user menu
And I click on "Multi-factor authentication preferences" "link"
Expand Down
14 changes: 13 additions & 1 deletion admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ Feature: Set up SMS factor in user preferences

Background:
Given I log in as "admin"
And I navigate to "Plugins > SMS > Manage SMS gateways" in site administration
And I follow "Create a new SMS gateway"
And I set the following fields to these values:
| SMS gateway provider | AWS |
| Gateway name | Dummy provider |
| Access key | key123 |
| Secret access key | secret456 |
And I press "Save changes"
And the following config values are set as admin:
| enabled | 1 | tool_mfa |
| lockout | 3 | tool_mfa |
And the following config values are set as admin:
| enabled | 1 | factor_sms |
| enabled | 1 | factor_sms |
| smsgateway | 536000 | factor_sms |
| weight | 100 | factor_sms |
| duration | 1800 | factor_sms |
When I follow "Preferences" in the user menu
And I click on "Multi-factor authentication preferences" "link"
And I click on "Set up" "button"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@tool @tool_mfa @factor_sms
Feature: Set up SMS factor when relevant gateway is not configured
In order configure the SMS factor
As an admin
I want to be directed to the SMS gateway setup when necessary

Scenario: Configuring gateways from the SMS factor settings
Given I log in as "admin"
And the following config values are set as admin:
| enabled | 1 | tool_mfa |
| lockout | 3 | tool_mfa |
And the following config values are set as admin:
| enabled | 1 | factor_sms |
| weight | 100 | factor_sms |
| duration | 1800 | factor_sms |
When I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration
And I follow "Edit settings for the SMS mobile phone factor"
And I should see "To use SMS as an authentication factor, you first need to set up an SMS gateway."
And I should see "set up an SMS gateway"
And I follow "set up an SMS gateway"
And I should see "Configure SMS gateway"
And I set the following fields to these values:
| SMS gateway provider | AWS |
| Gateway name | First AWS gateway |
| Country code | 61 |
| Access key | key123 |
| Secret access key | secret456 |
| Amazon API gateway region | ap-southeast-2 |
And I press "Save changes"
Then I should see "SMS mobile phone"
And the "SMS gateway" select box should contain "First AWS gateway (AWS)"
And I follow "create a new gateway"
And I should see "Configure SMS gateway"
And I set the following fields to these values:
| SMS gateway provider | AWS |
| Gateway name | Second one |
| Country code | 1 |
| Access key | key1234 |
| Secret access key | secret4567 |
| Amazon API gateway region | ap-southeast-2 |
And I press "Save changes"
Then I should see "SMS mobile phone"
And the "SMS gateway" select box should contain "First AWS gateway (AWS)"
And the "SMS gateway" select box should contain "Second one (AWS)"

0 comments on commit e93bbc3

Please sign in to comment.