forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into install_master
- Loading branch information
Showing
102 changed files
with
1,745 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Generates a secure key for the current server (presuming it does not already exist). | ||
* | ||
* @package core_admin | ||
* @copyright 2020 The Open University | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
use \core\encryption; | ||
|
||
define('CLI_SCRIPT', true); | ||
|
||
require(__DIR__ . '/../../config.php'); | ||
require_once($CFG->libdir . '/clilib.php'); | ||
|
||
// Get cli options. | ||
[$options, $unrecognized] = cli_get_params( | ||
['help' => false, 'method' => null], | ||
['h' => 'help']); | ||
|
||
if ($unrecognized) { | ||
$unrecognized = implode("\n ", $unrecognized); | ||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); | ||
} | ||
|
||
if ($options['help']) { | ||
echo "Generate secure key | ||
This script manually creates a secure key within the secret data root folder (configured in | ||
config.php as \$CFG->secretdataroot). You must run it using an account with access to write | ||
to that folder. | ||
In normal use Moodle automatically creates the key; this script is intended when setting up | ||
a new Moodle system, for cases where the secure folder is not on shared storage and the key | ||
may be manually installed on multiple servers. | ||
Options: | ||
-h, --help Print out this help | ||
--method <method> Generate key for specified encryption method instead of default. | ||
* sodium | ||
* openssl-aes-256-ctr | ||
Example: | ||
php admin/cli/generate_key.php | ||
"; | ||
exit; | ||
} | ||
|
||
$method = $options['method']; | ||
|
||
if (encryption::key_exists($method)) { | ||
echo 'Key already exists: ' . encryption::get_key_file($method) . "\n"; | ||
exit; | ||
} | ||
|
||
// Creates key with default permissions (no chmod). | ||
echo "Generating key...\n"; | ||
encryption::create_key($method, false); | ||
|
||
echo "\nKey created: " . encryption::get_key_file($method) . "\n\n"; | ||
echo "If the key folder is not shared storage, then key files should be copied to all servers.\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{{! | ||
This file is part of Moodle - http://moodle.org/ | ||
Moodle is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Moodle is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
}} | ||
{{! | ||
@template core_admin/admin_setting_encryptedpassword | ||
Admin encrypted password template. | ||
Context variables required for this template: | ||
* name - form element name | ||
* set - whether it is set or empty | ||
* id - element id | ||
Example context (json): | ||
{ | ||
"name": "test", | ||
"id": "test0", | ||
"set": true | ||
} | ||
}} | ||
<div class="core_admin_encryptedpassword" data-encryptedpasswordid="{{ id }}" | ||
{{#novalue}}data-novalue="y"{{/novalue}}> | ||
{{#set}} | ||
<span>{{# str }} encryptedpassword_set, admin {{/ str }}</span> | ||
{{/set}} | ||
{{^set}} | ||
<a href="#" title="{{# str }} encryptedpassword_edit, admin {{/ str }}"> | ||
<span>{{# str }} novalueclicktoset, form {{/ str }}</span> | ||
{{# pix }} t/passwordunmask-edit, core, {{# str }} passwordunmaskedithint, form {{/ str }}{{/ pix }} | ||
</a> | ||
{{/set}} | ||
<input style="display: none" type="password" name="{{name}}" disabled> | ||
{{! | ||
Using buttons instead of links here allows them to be connected to the label, so the button | ||
works if you click the label. | ||
}} | ||
{{#set}} | ||
<button type="button" id="{{id}}" title="{{# str }} encryptedpassword_edit, admin {{/ str }}" class="btn btn-link" data-editbutton> | ||
{{# pix }} t/passwordunmask-edit, core, {{/ pix }} | ||
</button> | ||
{{/set}} | ||
<button type="button" style="display: none" title="{{# str }} cancel {{/ str }}" class="btn btn-link" data-cancelbutton> | ||
<i class="icon fa fa-times"></i> | ||
</button> | ||
</div> | ||
|
||
{{#js}} | ||
require(['core_form/encryptedpassword'], function(encryptedpassword) { | ||
new encryptedpassword.EncryptedPassword("{{ id }}"); | ||
}); | ||
{{/js}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,15 +28,16 @@ Feature: Verify that keyboard steps work as expected | |
And I press the shift tab key | ||
And the focused element is "Username" "field" | ||
|
||
@javascript | ||
Scenario: Using the arrow keys allows me to navigate through menus | ||
Given the following "users" exist: | ||
| username | email | firstname | lastname | | ||
| saffronr | saffron.rutledge@example.com | Saffron | Rutledge | | ||
And I log in as "saffronr" | ||
And I click on "Saffron Rutledge" "link" in the ".usermenu" "css_element" | ||
When I press the up key | ||
Then the focused element is "Log out" "link" | ||
# TODO: Uncomment the following when MDL-66979 is integrated. | ||
# @javascript | ||
# Scenario: Using the arrow keys allows me to navigate through menus | ||
# Given the following "users" exist: | ||
# | username | email | firstname | lastname | | ||
# | saffronr | [email protected] | Saffron | Rutledge | | ||
# And I log in as "saffronr" | ||
# And I click on "Saffron Rutledge" "link" in the ".usermenu" "css_element" | ||
# When I press the up key | ||
# Then the focused element is "Log out" "link" | ||
|
||
@javascript | ||
Scenario: The escape key can be used to close a dialogue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.