MDL-8857
[moodle-linuxchix.git] / auth / none / auth.php
blob01305c9d9b337369300b3615509c6041f6d943ae
1 <?php
3 /**
4 * @author Martin Dougiamas
5 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
6 * @package moodle multiauth
8 * Authentication Plugin: No Authentication
10 * No authentication at all. This method approves everything!
12 * 2006-08-31 File created.
15 if (!defined('MOODLE_INTERNAL')) {
16 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
19 /**
20 * Plugin for no authentication.
22 class auth_plugin_none {
24 /**
25 * The configuration details for the plugin.
27 var $config;
29 var $canchangepassword = true;
30 var $isinternal = true;
32 /**
33 * Constructor.
35 function auth_plugin_none() {
36 $this->config = get_config('auth/none');
39 /**
40 * Returns true if the username and password work or don't exist and false
41 * if the user exists and the password is wrong.
43 * @param string $username The username
44 * @param string $password The password
45 * @return bool Authentication success or failure.
47 function user_login ($username, $password) {
48 global $CFG;
49 if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
50 return validate_internal_user_password($user, $password);
52 return false;
55 /**
56 * Updates the user's password.
58 * called when the user password is updated.
60 * @param object $user User table object (with system magic quotes)
61 * @param string $newpassword Plaintext password (with system magic quotes)
62 * @return boolean result
65 function user_update_password($user, $newpassword) {
66 $user = get_complete_user_data('id', $user->id);
67 return update_internal_user_password($user, $newpassword);
70 /**
71 * Returns true if this authentication plugin is 'internal'.
73 * @return bool
75 function is_internal() {
76 return true;
79 /**
80 * Returns true if this authentication plugin can change the user's
81 * password.
83 * @return bool
85 function can_change_password() {
86 return true;
89 /**
90 * Returns the URL for changing the user's pw, or empty if the default can
91 * be used.
93 * @return string
95 function change_password_url() {
96 return '';
99 /**
100 * Returns true if plugin allows resetting of internal password.
102 * @return bool
104 function can_reset_password() {
105 return true;
109 * Prints a form for configuring this authentication plugin.
111 * This function is called from admin/auth.php, and outputs a full page with
112 * a form for configuring this plugin.
114 * @param array $page An object containing all the data for this page.
116 function config_form($config, $err, $user_fields) {
117 include "config.html";
121 * Processes and stores configuration data for this authentication plugin.
123 function process_config($config) {
124 return true;