Skip to content

Commit

Permalink
MDL-69095 tool_mobile: Avoid non-https sites using qrlogin by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Jul 28, 2020
1 parent 94fdac9 commit f575093
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/tool/mobile/lang/en/tool_mobile.php
Expand Up @@ -114,7 +114,7 @@
$string['qrcodeformobileappurlabout'] = 'Scan the QR code with your mobile app to fill in the site URL in your app.';
$string['qrsiteadminsnotallowed'] = 'For security reasons login via QR code is not allowed for site administrators or if you are logged in as another user.';
$string['qrcodetype'] = 'QR code access';
$string['qrcodetype_desc'] = 'A QR code can be provided for mobile app users to scan and either have the site URL filled in or be automatically logged in without having to enter their credentials.';
$string['qrcodetype_desc'] = 'A QR code can be provided for mobile app users to scan. This can be used to fill in the site URL, or where the site is secured using HTTPS, to automatically log the user in without having to enter their username and password.';
$string['qrcodetypeurl'] = 'QR code with site URL';
$string['qrcodetypelogin'] = 'QR code with automatic login';
$string['readingthisemailgettheapp'] = 'Reading this in an email? <a href="{$a}">Download the mobile app and receive notifications on your mobile device</a>.';
Expand Down
10 changes: 8 additions & 2 deletions admin/tool/mobile/settings.php
Expand Up @@ -94,11 +94,17 @@
$options = [
tool_mobile\api::QR_CODE_DISABLED => new lang_string('qrcodedisabled', 'tool_mobile'),
tool_mobile\api::QR_CODE_URL => new lang_string('qrcodetypeurl', 'tool_mobile'),
tool_mobile\api::QR_CODE_LOGIN => new lang_string('qrcodetypelogin', 'tool_mobile'),
];
$qrcodetypedefault = tool_mobile\api::QR_CODE_URL;

if (is_https()) { // Allow QR login for https sites.
$options[tool_mobile\api::QR_CODE_LOGIN] = new lang_string('qrcodetypelogin', 'tool_mobile');
$qrcodetypedefault = tool_mobile\api::QR_CODE_LOGIN;
}

$temp->add(new admin_setting_configselect('tool_mobile/qrcodetype',
new lang_string('qrcodetype', 'tool_mobile'),
new lang_string('qrcodetype_desc', 'tool_mobile'), tool_mobile\api::QR_CODE_LOGIN, $options));
new lang_string('qrcodetype_desc', 'tool_mobile'), $qrcodetypedefault, $options));

$temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
new lang_string('forcedurlscheme_key', 'tool_mobile'),
Expand Down

0 comments on commit f575093

Please sign in to comment.