1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 namespace mod_bigbluebuttonbn\form; 18 defined('MOODLE_INTERNAL') || die; 19 global $CFG; 20 require_once($CFG->libdir . '/formslib.php'); 21 22 /** 23 * Guest login form. 24 * 25 * @package mod_bigbluebuttonbn 26 * @copyright 2022 onwards, Blindside Networks Inc 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 * @author Laurent David (laurent [at] call-learning [dt] fr) 29 */ 30 class guest_login extends \moodleform { 31 32 /** 33 * Form definition 34 */ 35 protected function definition() { 36 global $USER; 37 38 $mform = $this->_form; 39 $mform->addElement('text', 'username', 40 get_string('guestaccess_username', 'mod_bigbluebuttonbn')); 41 $mform->setType('username', PARAM_NOTAGS); 42 $mform->addRule('username', 43 get_string('required'), 'required', null, 'client'); 44 45 if (isloggedin() && !isguestuser()) { 46 $mform->setConstant('username', fullname($USER)); 47 $mform->freeze('username'); 48 } 49 50 $mform->addElement('password', 'password', 51 get_string('guestaccess_password', 'mod_bigbluebuttonbn')); 52 $mform->setType('password', PARAM_RAW); 53 $mform->addRule('password', 54 get_string('required'), 'required', null, 'client'); 55 $mform->addElement('hidden', 'uid', $this->_customdata['uid']); 56 $mform->setType('uid', PARAM_ALPHANUMEXT); 57 58 $this->add_action_buttons(false, get_string('guestaccess_join_meeting', 'mod_bigbluebuttonbn')); 59 } 60 61 /** 62 * Validate form 63 * 64 * @param array $data 65 * @param array $files 66 * @return array 67 * @throws \coding_exception 68 */ 69 public function validation($data, $files): array { 70 $errors = parent::validation($data, $files); 71 $instance = $this->_customdata['instance']; 72 if ($data['password'] != $instance->get_guest_access_password()) { 73 $errors['password'] = get_string('guestaccess_meeting_invalid_password', 'mod_bigbluebuttonbn'); 74 } 75 return $errors; 76 } 77 } 78
title
Description
Body
title
Description
Body
title
Description
Body
title
Body