Skip to content

Commit bb267a1

Browse files
committed
Merge branch 'MDL-80967-main' of https://github.com/StudiUM/moodle
2 parents 110f5b5 + fd4ebbf commit bb267a1

File tree

4 files changed

+49
-38
lines changed

4 files changed

+49
-38
lines changed

admin/settings/plugins.php

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
new lang_string('limitconcurrentlogins_desc', 'core_auth'), 0, $options));
103103
$temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'),
104104
new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url(), ENT_COMPAT)), ''));
105+
$temp->add(new admin_setting_configcheckbox('showloginform', new lang_string('showloginform', 'core_auth'),
106+
new lang_string('showloginform_desc', 'core_auth'), 1));
105107
$temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'),
106108
new lang_string('forgottenpassword', 'auth'), '', PARAM_URL));
107109
$temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'),

auth/classes/output/login.php

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public function export_for_template(renderer_base $output) {
186186
$data->recaptcha = $this->recaptcha;
187187
$data->togglepassword = $this->togglepassword;
188188
$data->smallscreensonly = $this->smallscreensonly;
189+
$data->showloginform = get_config('core', 'showloginform') === false || get_config('core', 'showloginform');
189190

190191
return $data;
191192
}

lang/en/auth.php

+4
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
$string['settingmigrationmismatch'] = 'Values mismatch detected while correcting the plugin setting names! The authentication plugin \'{$a->plugin}\' had the setting \'{$a->setting}\' configured to \'{$a->legacy}\' under the legacy name and to \'{$a->current}\' under the current name. The latter value has been set as the valid one but you should check and confirm that it is expected.';
158158
$string['sha1'] = 'SHA-1 hash';
159159
$string['showguestlogin'] = 'You can hide or show the guest login button on the login page.';
160+
$string['showloginform'] = 'Show the Moodle login form or not.';
161+
$string['showloginform_desc'] = 'If your site uses authentication methods that don\'t require people to enter their email/username and password, such as OAuth2, you may want to hide the standard login form. This is not compatible with Manual accounts.
162+
163+
If you are unable to log in and you want to show the login form, you can change this config with the command line: php admin/cli/cfg.php --name=showloginform --set=1';
160164
$string['stdchangepassword'] = 'Use standard page for changing password';
161165
$string['stdchangepassword_expl'] = 'If the external authentication system allows password changes through Moodle, switch this to Yes. This setting overrides \'Change Password URL\'.';
162166
$string['stdchangepassword_explldap'] = 'NOTE: It is recommended that you use LDAP over an SSL encrypted tunnel (ldaps://) if the LDAP server is remote.';

lib/templates/loginform.mustache

+42-38
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* canloginasguest - Is guest login allowed?,
2525
* canloginbyemail - Is login by email allowed?,
2626
* cansignup - Signup allowed?,
27+
* showloginform - Hide the standard login form if it not necessary (only OAuth2 for example)
2728
* cookieshelpicon - cookies help icon details
2829
* error - Any errors in the form?,
2930
* info - Info notification to display,
@@ -47,6 +48,7 @@
4748
"canloginasguest": "1",
4849
"canloginbyemail": false,
4950
"cansignup": true,
51+
"showloginform": true,
5052
"cookieshelpicon": {
5153
"heading": "Cookies must be enabled in your browser",
5254
"text": "<div class=\"no-overflow\">Two cookies are used on this site. Both died..</div>",
@@ -123,45 +125,47 @@
123125
{{#cansignup}}
124126
<a href="{{signupurl}}" class="sr-only">{{#str}} tocreatenewaccount {{/str}}</a>
125127
{{/cansignup}}
126-
<form class="login-form" action="{{loginurl}}" method="post" id="login">
127-
<input id="anchor" type="hidden" name="anchor" value="">
128-
<script>document.getElementById('anchor').value = location.hash;</script>
129-
<input type="hidden" name="logintoken" value="{{logintoken}}">
130-
<div class="login-form-username mb-3">
131-
<label for="username" class="sr-only">
132-
{{^canloginbyemail}}
133-
{{#str}} username {{/str}}
134-
{{/canloginbyemail}}
135-
{{#canloginbyemail}}
136-
{{#str}} usernameemail {{/str}}
137-
{{/canloginbyemail}}
138-
</label>
139-
<input type="text" name="username" id="username" {{!
140-
!}}class="form-control form-control-lg" {{!
141-
!}}value="{{username}}" {{!
142-
!}}placeholder="{{^canloginbyemail}}{{#cleanstr}}username{{/cleanstr}}{{/canloginbyemail}}{{!
143-
!}}{{#canloginbyemail}}{{#cleanstr}}usernameemail{{/cleanstr}}{{/canloginbyemail}}" {{!
144-
!}}autocomplete="username">
145-
</div>
146-
<div class="login-form-password mb-3">
147-
<label for="password" class="sr-only">{{#str}} password {{/str}}</label>
148-
<input type="password" name="password" id="password" value="" {{!
149-
!}}class="form-control form-control-lg" {{!
150-
!}}placeholder="{{#cleanstr}}password{{/cleanstr}}" {{!
151-
!}}autocomplete="current-password">
152-
</div>
153-
{{#recaptcha}}
154-
<div class="login-form-recaptcha mb-3">
155-
{{{recaptcha}}}
128+
{{#showloginform}}
129+
<form class="login-form" action="{{loginurl}}" method="post" id="login">
130+
<input id="anchor" type="hidden" name="anchor" value="">
131+
<script>document.getElementById('anchor').value = location.hash;</script>
132+
<input type="hidden" name="logintoken" value="{{logintoken}}">
133+
<div class="login-form-username mb-3">
134+
<label for="username" class="sr-only">
135+
{{^canloginbyemail}}
136+
{{#str}} username {{/str}}
137+
{{/canloginbyemail}}
138+
{{#canloginbyemail}}
139+
{{#str}} usernameemail {{/str}}
140+
{{/canloginbyemail}}
141+
</label>
142+
<input type="text" name="username" id="username" {{!
143+
!}}class="form-control form-control-lg" {{!
144+
!}}value="{{username}}" {{!
145+
!}}placeholder="{{^canloginbyemail}}{{#cleanstr}}username{{/cleanstr}}{{/canloginbyemail}}{{!
146+
!}}{{#canloginbyemail}}{{#cleanstr}}usernameemail{{/cleanstr}}{{/canloginbyemail}}" {{!
147+
!}}autocomplete="username">
156148
</div>
157-
{{/recaptcha}}
158-
<div class="login-form-submit mb-3">
159-
<button class="btn btn-primary btn-lg" type="submit" id="loginbtn">{{#str}}login{{/str}}</button>
160-
</div>
161-
<div class="login-form-forgotpassword mb-3">
162-
<a href="{{forgotpasswordurl}}">{{#str}}forgotaccount{{/str}}</a>
163-
</div>
164-
</form>
149+
<div class="login-form-password mb-3">
150+
<label for="password" class="sr-only">{{#str}} password {{/str}}</label>
151+
<input type="password" name="password" id="password" value="" {{!
152+
!}}class="form-control form-control-lg" {{!
153+
!}}placeholder="{{#cleanstr}}password{{/cleanstr}}" {{!
154+
!}}autocomplete="current-password">
155+
</div>
156+
{{#recaptcha}}
157+
<div class="login-form-recaptcha mb-3">
158+
{{{recaptcha}}}
159+
</div>
160+
{{/recaptcha}}
161+
<div class="login-form-submit mb-3">
162+
<button class="btn btn-primary btn-lg" type="submit" id="loginbtn">{{#str}}login{{/str}}</button>
163+
</div>
164+
<div class="login-form-forgotpassword mb-3">
165+
<a href="{{forgotpasswordurl}}">{{#str}}forgotaccount{{/str}}</a>
166+
</div>
167+
</form>
168+
{{/showloginform}}
165169
{{#hasidentityproviders}}
166170
<div class="login-divider"></div>
167171
<div class="login-identityproviders">

0 commit comments

Comments
 (0)