diff --git a/CHANGES.md b/CHANGES.md index 5fc6ebc430e..af127d7c724 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,9 @@ moodle-theme_boost_union Changes ------- +### Unreleased +* 2023-11-23 - Bugfix: Add background color to OAuth2 login button, solves #473. + ### v4.3-r2 * 2023-11-11 - Bugfix: Bulk actions widget overlaid course header image, solves #469. diff --git a/templates/core/loginform.mustache b/templates/core/loginform.mustache new file mode 100644 index 00000000000..bafe779d407 --- /dev/null +++ b/templates/core/loginform.mustache @@ -0,0 +1,241 @@ +{{! + 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 . +}} +{{! + @template core/loginform + + Moodle template for the login page. + + Context variables required for this template: + * autofocusform: Auto focus on form ?, + * canloginasguest - Is guest login allowed?, + * canloginbyemail - Is login by email allowed?, + * cansignup - Signup allowed?, + * cookieshelpicon - cookies help icon details + * error - Any errors in the form?, + * info - Info notification to display, + * forgotpasswordurl - Forgot password url, + * hasidentityproviders - Flag, set to true to hide identity providers, + * hasinstructions - Flag, set to true to show instructions, + * identityproviders - List of identiy providers, + * instructions - Instructions, + * instructionsformat - Format of instructions, + * loginurl - Login url, + * signupurl - Signup url, + * errorformatted - Formatted error, + * logourl - Flag, logo url, + * sitename - Name of site., + * logintoken - Random token to protect login request., + * maintenance - Maintenance message + + Example context (json): + { + "autofocusform": false, + "canloginasguest": "1", + "canloginbyemail": false, + "cansignup": true, + "cookieshelpicon": { + "heading": "Cookies must be enabled in your browser", + "text": "
Two cookies are used on this site. Both died..
", + "icon": { + "attributes": [ + { + "name": "class", + "value": "iconhelp" + }, + { + "name": "alt", + "value": "Help with Cookies must be enabled in your browser" + }, + { + "name": "title", + "value": "Help with Cookies must be enabled in your browser" + }, + { + "name": "src", + "value": "http://localhost/stable_master/theme/image.php?theme=boost&component=core&image=help" + } + ] + }, + "linktext": null, + "title": "Help with Cookies must be enabled in your browser", + "url": "http://localhost/stable_master/help.php?component=core&identifier=cookiesenabled&lang=en", + "ltr": true + }, + "error": "", + "info": "", + "forgotpasswordurl": "http://localhost/stable_master/login/forgot_password.php", + "hasidentityproviders": false, + "hasinstructions": true, + "identityproviders": [], + "instructions": "For full access to this site, you first need to create an account.", + "instructionsformat": "1", + "loginurl": "http://localhost/stable_master/login/index.php", + "signupurl": "http://localhost/stable_master/login/signup.php", + "cookieshelpiconformatted": "", + "errorformatted": "", + "logourl": false, + "sitename": "Beer & Chips", + "logintoken": "randomstring", + "maintenance": "For full access to this site, you need to login in as an admin.", + "languagemenu": "Choose language" + } +}} +{{! + This template is a modified version of core/loginform + + Modifications compared to the original template: + * Add btn-secondary class to identityprovider login buttons. +}} + +
+ {{#logourl}} + + {{/logourl}} + {{^logourl}} +

{{#str}} loginto, core, {{sitename}} {{/str}}

+ {{/logourl}} + {{#maintenance}} + + {{/maintenance}} + {{#error}} + {{error}} + + {{/error}} + {{#info}} + {{info}} + + {{/info}} + {{#cansignup}} + {{#str}} tocreatenewaccount {{/str}} + {{/cansignup}} + + {{#hasidentityproviders}} + + + {{/hasidentityproviders}} + {{#hasinstructions}} + + + {{/hasinstructions}} + {{#cansignup}} + + {{/cansignup}} + {{#canloginasguest}} + + +
+ + + + +
+ {{/canloginasguest}} + +
+ {{#languagemenu}} + +
+ {{/languagemenu}} + +
+
+ +{{#js}} + {{^error}} + {{#autofocusform}} + var userNameField = document.getElementById('username'); + if (userNameField.value.length == 0) { + userNameField.focus(); + } else { + document.getElementById('password').focus(); + } + {{/autofocusform}} + {{/error}} + {{#error}} + document.getElementById('loginerrormessage').focus(); + {{/error}} + require(['core_form/submit'], function(Submit) { + Submit.init("loginbtn"); + {{#canloginasguest}} + Submit.init("loginguestbtn"); + {{/canloginasguest}} + }); +{{/js}} diff --git a/templates/core/loginform.mustache.upstream b/templates/core/loginform.mustache.upstream new file mode 100644 index 00000000000..034b0c85fd8 --- /dev/null +++ b/templates/core/loginform.mustache.upstream @@ -0,0 +1,235 @@ +{{! + 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 . +}} +{{! + @template core/loginform + + Moodle template for the login page. + + Context variables required for this template: + * autofocusform: Auto focus on form ?, + * canloginasguest - Is guest login allowed?, + * canloginbyemail - Is login by email allowed?, + * cansignup - Signup allowed?, + * cookieshelpicon - cookies help icon details + * error - Any errors in the form?, + * info - Info notification to display, + * forgotpasswordurl - Forgot password url, + * hasidentityproviders - Flag, set to true to hide identity providers, + * hasinstructions - Flag, set to true to show instructions, + * identityproviders - List of identiy providers, + * instructions - Instructions, + * instructionsformat - Format of instructions, + * loginurl - Login url, + * signupurl - Signup url, + * errorformatted - Formatted error, + * logourl - Flag, logo url, + * sitename - Name of site., + * logintoken - Random token to protect login request., + * maintenance - Maintenance message + + Example context (json): + { + "autofocusform": false, + "canloginasguest": "1", + "canloginbyemail": false, + "cansignup": true, + "cookieshelpicon": { + "heading": "Cookies must be enabled in your browser", + "text": "
Two cookies are used on this site. Both died..
", + "icon": { + "attributes": [ + { + "name": "class", + "value": "iconhelp" + }, + { + "name": "alt", + "value": "Help with Cookies must be enabled in your browser" + }, + { + "name": "title", + "value": "Help with Cookies must be enabled in your browser" + }, + { + "name": "src", + "value": "http://localhost/stable_master/theme/image.php?theme=boost&component=core&image=help" + } + ] + }, + "linktext": null, + "title": "Help with Cookies must be enabled in your browser", + "url": "http://localhost/stable_master/help.php?component=core&identifier=cookiesenabled&lang=en", + "ltr": true + }, + "error": "", + "info": "", + "forgotpasswordurl": "http://localhost/stable_master/login/forgot_password.php", + "hasidentityproviders": false, + "hasinstructions": true, + "identityproviders": [], + "instructions": "For full access to this site, you first need to create an account.", + "instructionsformat": "1", + "loginurl": "http://localhost/stable_master/login/index.php", + "signupurl": "http://localhost/stable_master/login/signup.php", + "cookieshelpiconformatted": "", + "errorformatted": "", + "logourl": false, + "sitename": "Beer & Chips", + "logintoken": "randomstring", + "maintenance": "For full access to this site, you need to login in as an admin.", + "languagemenu": "Choose language" + } +}} + +
+ {{#logourl}} + + {{/logourl}} + {{^logourl}} +

{{#str}} loginto, core, {{sitename}} {{/str}}

+ {{/logourl}} + {{#maintenance}} + + {{/maintenance}} + {{#error}} + {{error}} + + {{/error}} + {{#info}} + {{info}} + + {{/info}} + {{#cansignup}} + {{#str}} tocreatenewaccount {{/str}} + {{/cansignup}} + + {{#hasidentityproviders}} + + + {{/hasidentityproviders}} + {{#hasinstructions}} + + + {{/hasinstructions}} + {{#cansignup}} + + {{/cansignup}} + {{#canloginasguest}} + + +
+ + + + +
+ {{/canloginasguest}} + +
+ {{#languagemenu}} + +
+ {{/languagemenu}} + +
+
+ +{{#js}} + {{^error}} + {{#autofocusform}} + var userNameField = document.getElementById('username'); + if (userNameField.value.length == 0) { + userNameField.focus(); + } else { + document.getElementById('password').focus(); + } + {{/autofocusform}} + {{/error}} + {{#error}} + document.getElementById('loginerrormessage').focus(); + {{/error}} + require(['core_form/submit'], function(Submit) { + Submit.init("loginbtn"); + {{#canloginasguest}} + Submit.init("loginguestbtn"); + {{/canloginasguest}} + }); +{{/js}}