adding some strings
[moodle-linuxchix.git] / auth / manual / auth.php
blob6f1e7ca620198e19945f7193d10c30724abe1cd4
1 <?php
2 /**
3 * @author Martin Dougiamas
4 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
5 * @package moodle multiauth
7 * Authentication Plugin: Manual Authentication
9 * Just does a simple check against the moodle database.
11 * 2006-08-28 File created.
14 if (!defined('MOODLE_INTERNAL')) {
15 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
18 require_once($CFG->libdir.'/authlib.php');
20 /**
21 * Manual authentication plugin.
23 class auth_plugin_manual extends auth_plugin_base {
25 /**
26 * Constructor.
28 function auth_plugin_manual() {
29 $this->authtype = 'manual';
30 $this->config = get_config('auth/manual');
33 /**
34 * Returns true if the username and password work and false if they are
35 * wrong or don't exist.
37 * @param string $username The username (with system magic quotes)
38 * @param string $password The password (with system magic quotes)
40 * @return bool Authentication success or failure.
42 function user_login ($username, $password) {
43 global $CFG;
44 if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
45 return validate_internal_user_password($user, $password);
47 return false;
50 /**
51 * Updates the user's password.
53 * called when the user password is updated.
55 * @param object $user User table object (with system magic quotes)
56 * @param string $newpassword Plaintext password (with system magic quotes)
57 * @return boolean result
60 function user_update_password($user, $newpassword) {
61 $user = get_complete_user_data('id', $user->id);
62 return update_internal_user_password($user, $newpassword);
65 /**
66 * Returns true if this authentication plugin is 'internal'.
68 * @return bool
70 function is_internal() {
71 return true;
74 /**
75 * Returns true if this authentication plugin can change the user's
76 * password.
78 * @return bool
80 function can_change_password() {
81 return true;
84 /**
85 * Returns the URL for changing the user's pw, or empty if the default can
86 * be used.
88 * @return string
90 function change_password_url() {
91 return '';
94 /**
95 * Returns true if plugin allows resetting of internal password.
97 * @return bool
99 function can_reset_password() {
100 return true;
104 * Prints a form for configuring this authentication plugin.
106 * This function is called from admin/auth.php, and outputs a full page with
107 * a form for configuring this plugin.
109 * @param array $page An object containing all the data for this page.
111 function config_form($config, $err, $user_fields) {
112 include 'config.html';
116 * Processes and stores configuration data for this authentication plugin.
118 function process_config($config) {
119 return true;