[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 /** 18 * Anobody can login with any password. 19 * 20 * @package auth_none 21 * @author Martin Dougiamas 22 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 require_once($CFG->libdir.'/authlib.php'); 28 29 /** 30 * Plugin for no authentication. 31 */ 32 class auth_plugin_none extends auth_plugin_base { 33 34 /** 35 * Constructor. 36 */ 37 function auth_plugin_none() { 38 $this->authtype = 'none'; 39 $this->config = get_config('auth/none'); 40 } 41 42 /** 43 * Returns true if the username and password work or don't exist and false 44 * if the user exists and the password is wrong. 45 * 46 * @param string $username The username 47 * @param string $password The password 48 * @return bool Authentication success or failure. 49 */ 50 function user_login ($username, $password) { 51 global $CFG, $DB; 52 if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) { 53 return validate_internal_user_password($user, $password); 54 } 55 return true; 56 } 57 58 /** 59 * Updates the user's password. 60 * 61 * called when the user password is updated. 62 * 63 * @param object $user User table object 64 * @param string $newpassword Plaintext password 65 * @return boolean result 66 * 67 */ 68 function user_update_password($user, $newpassword) { 69 $user = get_complete_user_data('id', $user->id); 70 // This will also update the stored hash to the latest algorithm 71 // if the existing hash is using an out-of-date algorithm (or the 72 // legacy md5 algorithm). 73 return update_internal_user_password($user, $newpassword); 74 } 75 76 function prevent_local_passwords() { 77 return false; 78 } 79 80 /** 81 * Returns true if this authentication plugin is 'internal'. 82 * 83 * @return bool 84 */ 85 function is_internal() { 86 return true; 87 } 88 89 /** 90 * Returns true if this authentication plugin can change the user's 91 * password. 92 * 93 * @return bool 94 */ 95 function can_change_password() { 96 return true; 97 } 98 99 /** 100 * Returns the URL for changing the user's pw, or empty if the default can 101 * be used. 102 * 103 * @return moodle_url 104 */ 105 function change_password_url() { 106 return null; 107 } 108 109 /** 110 * Returns true if plugin allows resetting of internal password. 111 * 112 * @return bool 113 */ 114 function can_reset_password() { 115 return true; 116 } 117 118 /** 119 * Returns true if plugin can be manually set. 120 * 121 * @return bool 122 */ 123 function can_be_manually_set() { 124 return true; 125 } 126 127 /** 128 * Prints a form for configuring this authentication plugin. 129 * 130 * This function is called from admin/auth.php, and outputs a full page with 131 * a form for configuring this plugin. 132 * 133 * @param array $page An object containing all the data for this page. 134 */ 135 function config_form($config, $err, $user_fields) { 136 include "config.html"; 137 } 138 139 /** 140 * Processes and stores configuration data for this authentication plugin. 141 */ 142 function process_config($config) { 143 return true; 144 } 145 146 } 147 148
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |