Skip to content

Commit

Permalink
MDL-81924 factor_sms: Remove leftover AWS implementation
Browse files Browse the repository at this point in the history
Originally implemented as MDL-80962.
  • Loading branch information
safatshahin authored and HuongNV13 committed Sep 23, 2024
1 parent b5ac325 commit cceed87
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 313 deletions.
9 changes: 9 additions & 0 deletions .upgradenotes/MDL-80962-2024071606510000.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
issueNumber: MDL-80962
notes:
factor_sms:
- message: >
The following classes are removed as the SMS feature now takes advantage of core_sms API:
- sms_sent (admin/tool/mfa/factor/sms/classes/event/sms_sent.php)
- aws_sns (admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php)
- gateway_interface (admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php)
type: removed
62 changes: 0 additions & 62 deletions admin/tool/mfa/factor/sms/classes/event/sms_sent.php

This file was deleted.

9 changes: 5 additions & 4 deletions admin/tool/mfa/factor/sms/classes/factor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use moodle_url;
use stdClass;
use tool_mfa\local\factor\object_factor_base;
use tool_mfa\local\secret_manager;

/**
* SMS Factor implementation.
Expand Down Expand Up @@ -231,7 +232,7 @@ public function setup_factor_form_is_cancelled(int $factorid): void {
unset($SESSION->tool_mfa_sms_number);
}
// Clean temp secrets code.
$secretmanager = new \tool_mfa\local\secret_manager('sms');
$secretmanager = new secret_manager('sms');
$secretmanager->cleanup_temp_secrets();
}

Expand Down Expand Up @@ -424,7 +425,7 @@ private function sms_verification_code(int $secret, ?string $phonenumber): void
* @return bool
*/
private function check_verification_code(string $enteredcode): bool {
return ($this->secretmanager->validate_secret($enteredcode) === \tool_mfa\local\secret_manager::VALID) ? true : false;
return $this->secretmanager->validate_secret($enteredcode) === secret_manager::VALID;
}

/**
Expand Down Expand Up @@ -453,8 +454,8 @@ public function get_login_desc(): string {

if (empty($phonenumber)) {
return get_string('errorsmssent', 'factor_sms');
} else {
return get_string('logindesc', 'factor_' . $this->name, $phonenumber);
}

return get_string('logindesc', 'factor_' . $this->name, $phonenumber);
}
}
151 changes: 0 additions & 151 deletions admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php

This file was deleted.

This file was deleted.

13 changes: 13 additions & 0 deletions admin/tool/mfa/factor/sms/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,18 @@ classname: \smsgateway_aws\gateway::class,
upgrade_plugin_savepoint(true, 2024082200, 'factor', 'sms');
}

if ($oldversion < 2024082201) {
// Unset the removed admin settings.
unset_config('countrycode', 'factor_sms');
unset_config('gateway', 'factor_sms');
unset_config('usecredchain', 'factor_sms');
unset_config('api_key', 'factor_sms');
unset_config('api_secret', 'factor_sms');
unset_config('api_region', 'factor_sms');

// MFA savepoint reached.
upgrade_plugin_savepoint(true, 2024082201, 'factor', 'sms');
}

return true;
}
15 changes: 15 additions & 0 deletions admin/tool/mfa/factor/sms/lang/en/deprecated.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
settings:countrycode,factor_sms
settings:countrycode_help,factor_sms
settings:aws,factor_sms
settings:aws:key,factor_sms
settings:aws:key_help,factor_sms
settings:aws:region,factor_sms
settings:aws:region_help,factor_sms
settings:aws:secret,factor_sms
settings:aws:secret_help,factor_sms
settings:aws:usecredchain,factor_sms
settings:gateway,factor_sms
settings:gateway_help,factor_sms
errorawsconection,factor_sms
event:smssentdescription,factor_sms
event:smssent,factor_sms
Loading

0 comments on commit cceed87

Please sign in to comment.