summaryrefslogtreecommitdiff
path: root/inc/auth_plain.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/auth_plain.php')
-rw-r--r--inc/auth_plain.php35
1 files changed, 24 insertions, 11 deletions
diff --git a/inc/auth_plain.php b/inc/auth_plain.php
index 2b45b94ca..4213b8dcc 100644
--- a/inc/auth_plain.php
+++ b/inc/auth_plain.php
@@ -1,21 +1,28 @@
<?php
-
/**
+ * Plaintext authentication backend
+ *
* If you want to authenticate against something
* else then the builtin flatfile auth system
* you have to reimplement the "required auth
* functions"
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Andreas Gohr <andi@splitbrain.org>
*/
/**
- * required auth function
+ * Check user+password [required auth function]
*
* Checks if the given user exists and the given
* plaintext password is correct
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @return bool
*/
function auth_checkPass($user,$pass){
- $users = auth_loadUserData();
+ $users = auth_plain_loadUserData();
$pass = md5($pass); //encode pass
if($users[$user]['pass'] == $pass){
@@ -26,7 +33,7 @@ function auth_checkPass($user,$pass){
}
/**
- * Required auth function
+ * Return user info [required auth function]
*
* Returns info about the given user needs to contain
* at least these fields:
@@ -34,16 +41,16 @@ function auth_checkPass($user,$pass){
* name string full name of the user
* mail string email addres of the user
* grps array list of groups the user is in
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
*/
function auth_getUserData($user){
- $users = auth_loadUserData();
+ $users = auth_plain_loadUserData();
return $users[$user];
}
/**
- * Required auth function
- *
- * Creates a new user.
+ * Create a new User [required auth function]
*
* Returns false if the user already exists, null when an error
* occured and the cleartext password of the new user if
@@ -51,11 +58,13 @@ function auth_getUserData($user){
*
* The new user HAS TO be added to the default group by this
* function!
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
*/
function auth_createUser($user,$name,$mail){
global $conf;
- $users = auth_loadUserData();
+ $users = auth_plain_loadUserData();
if(isset($users[$user])) return false;
$pass = auth_pwgen();
@@ -76,10 +85,14 @@ function auth_createUser($user,$name,$mail){
}
/**
- * used by the plaintext auth functions
+ * Load all user data
+ *
+ * Used by the plaintext auth functions
* loads the user file into a datastructure
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
*/
-function auth_loadUserData(){
+function auth_plain_loadUserData(){
$data = array();
$lines = file('conf/users.auth');
foreach($lines as $line){