setting form: logstore disabled warning, lang: updates and corrections

This commit is contained in:
Paweł Suwiński
2020-11-18 14:36:38 +01:00
parent fc56948099
commit 03680da8f0
4 changed files with 35 additions and 14 deletions

View File

@@ -31,11 +31,12 @@ $string['otpsentsuccess'] = 'One-time password was sent to given email.';
$string['otpsenterror'] = 'An error occurred while sending one-time password.';
$string['otpsentinfo'] = 'One-time password for current session was already generated and sent to email.';
$string['otprevoked'] = 'Previously generated password has been revoked due to exceeding the login failure threshold.';
$string['otpperioderror'] = 'Minim period after which another password can be generated not preserved. Try again later.';
$string['otpperiodwarning'] = 'Minim period after which another password can be generated not preserved. Try again later.';
$string['revokethreshold'] = 'Revoke threshold';
$string['revokethreshold_help'] = 'Login failures limit causing revoke of the generated password (0 - unlimited).';
$string['minrequestperiod'] = 'Minium period';
$string['minrequestperiod_help'] = 'A time in seconds after which another password can be generated.';
$string['minrequestperiod_help'] = 'A time in seconds after which another password can be generated (0 - unrestricted). Enabled logstore required.';
$string['logstorerequired'] = '<b>Notice: no working logstore! <a href="{$a}">Enable logstore</a> or set time to 0.</b>';
$string['fieldsmapping'] = 'User profile fields mapping';
$string['fieldsmapping_pattern'] = 'Pattern';
$string['fieldsmapping_pattern_help'] = 'Capturing groups PCRE pattern.';
@@ -46,11 +47,12 @@ $string['fieldsmapping_help'] = <<<'EOT'
Pattern:<br />
<pre>
'#/?P<FIRST>[^\.]+)\.(?P<LAST>[^@]+)@(?P<COMPANY>[^\.]+).*#',
'#/?P&lt;FIRST&gt;[^\.]+)\.(?P&lt;LAST&gt;[^@]+)@(?P&lt;COMPANY&gt;[^\.]+).*#',
</pre>
Mapping:<br />
<pre>
username:FIRST_LAST
firstname:FIRST:ucfirst
lastname:LAST:ucfirst
institution:COMPANY:strtoupper
@@ -58,9 +60,11 @@ institution:COMPANY:strtoupper
<p>maps <em>my.name@corp.com</em> to:</p>
username: my_name<br />
firstname: My<br />
lastname: Name<br />
institution: CORP<br />
<p>Allowed modifiers: ucfirst, ucwords, strtoupper.</p>
<p>Allowed modifiers: ucfirst, ucwords, strtoupper. Without mapping of
<em>username</em> field whole email address is taken as username.</p>
EOT;

View File

@@ -31,11 +31,12 @@ $string['otpsentsuccess'] = 'Hasło jednorazowe zostało wysłane na podany adre
$string['otpsenterror'] = 'Wystąpił błąd podczas wysyłania hasła jednorazowego.';
$string['otpsentinfo'] = 'Hasło jednorazowe dla bieżącej sesji już zostało wygenerowane i wysłane.';
$string['otpinvalidated'] = 'Poprzednio wygenerowane hasło zostało unieważnione z powodu przekroczenia limitu niepoprawnych logowań.';
$string['otpperioderror'] = 'Nie zachowany minimalny odstęp, po którym kolejne hasło może być wygenerowane. Spróbuj ponownie później.';
$string['otpperiodwarning'] = 'Nie zachowany minimalny odstęp, po którym kolejne hasło może być wygenerowane. Spróbuj ponownie później.';
$string['revokethreshold'] = 'Próg nieważnienia';
$string['revokethreshold_help'] = 'Limit nieudanych logowań unieważniających wygenerowane hasło (0 - bez limitu).';
$string['minrequestperiod'] = 'Minimalny odstęp';
$string['minrequestperiod_help'] = 'Czas w sekundach, po którym kolejne hasło może być wygenerowane.';
$string['minrequestperiod_help'] = 'Czas w sekundach, po którym kolejne hasło może być wygenerowane (0 - nieograniczony). Wymaga działającego loggera.';
$string['logstorerequired'] = '<b>Uwaga: logger nieaktywny! <a href="{$a}">Aktywuj logger</a> albo ustaw czas na 0.</b>';
$string['fieldsmapping'] = 'Mapowanie pól profilu użytkownika';
$string['fieldsmapping_pattern'] = 'Wzorzec';
$string['fieldsmapping_pattern_help'] = 'Grupujące wyrażenie regularne PCRE.';
@@ -46,11 +47,12 @@ $string['fieldsmapping_help'] = <<<'EOT'
Wzorzec:<br />
<pre>
'#/?P<FIRST>[^\.]+)\.(?P<LAST>[^@]+)@(?P<COMPANY>[^\.]+).*#',
'#/?P&lt;FIRST&gt;[^\.]+)\.(?P&lt;LAST&gt;[^@]+)@(?P&lt;COMPANY&gt;[^\.]+).*#',
</pre>
Mapowanie:<br />
<pre>
username:FIRST_LAST
firstname:FIRST:ucfirst
lastname:LAST:ucfirst
institution:COMPANY:strtoupper
@@ -58,9 +60,12 @@ institution:COMPANY:strtoupper
<p>odwzoruje <em>my.name@corp.com</em> na:</p>
username: my_name<br />
firstname: My<br />
lastname: Name<br />
institution: CORP<br />
<p>Dozwolone modyfikatory: ucfirst, ucwords, strtoupper.</p>
<p>Dozwolone modyfikatory: ucfirst, ucwords, strtoupper. Przy braku mapowania
pola <em>username</em> domyślnie cały adres email jest traktowany jako nazwa
użytkownika.</p>
EOT;

View File

@@ -53,15 +53,27 @@ if ($ADMIN->fulltree) {
get_string('fieldsmapping_mapping_help', 'auth_emailotp'), '', PARAM_RAW_TRIMMED));
$settings->add(new admin_setting_heading('auth_emailotp/security',
new lang_string('security', 'admin'), ''));
new lang_string('security', 'admin'), ''));
$settings->add(new admin_setting_configtext('auth_emailotp/revokethreshold',
get_string('revokethreshold', 'auth_emailotp'),
get_string('revokethreshold_help', 'auth_emailotp'), 3, PARAM_INT));
$settings->add(new admin_setting_configtext('auth_emailotp/minrequestperiod',
$settings->add(new class(
'auth_emailotp/minrequestperiod',
get_string('minrequestperiod', 'auth_emailotp'),
get_string('minrequestperiod_help', 'auth_emailotp'), 120, PARAM_INT));
get_string('minrequestperiod_help', 'auth_emailotp')
) extends admin_setting_configtext {
public function __construct($name, $visiblename, $description) {
$log_reader = reset(get_log_manager()->get_readers('\core\log\sql_reader'));
parent::__construct($name, $visiblename, $description, $log_reader ? 120 : 0, PARAM_INT);
if(!$log_reader && !empty($this->get_setting())) {
$this->description .= ' '.get_string('logstorerequired', 'auth_emailotp',
(string)new moodle_url('/admin/settings.php', ['section' => 'managelogging'])
);
}
}
});
// Display locking / mapping of profile fields.
$authplugin = get_auth_plugin('emailotp');

View File

@@ -24,8 +24,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020111004; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2020111800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018120304; // Requires this Moodle version.
$plugin->component = 'auth_emailotp'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.0.2';
$plugin->maturity = MATURITY_ALPHA;
$plugin->release = '1.1.0';