summaryrefslogtreecommitdiffstats
path: root/login.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-14 17:29:07 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-14 17:29:07 +0000
commit78167c02518ff9d757741f0e8df524da300d067d (patch)
treed5fbbc41f6e807439de0d34ca9a06616dd961d04 /login.php
parent9a16ee2c2ce55e7693c9432be2466210a0ebc6df (diff)
downloadampache-78167c02518ff9d757741f0e8df524da300d067d.tar.gz
ampache-78167c02518ff9d757741f0e8df524da300d067d.tar.bz2
ampache-78167c02518ff9d757741f0e8df524da300d067d.zip
removed extra lines from ajax, down to 86, updated ajax calls, added ldap auth
Diffstat (limited to 'login.php')
-rw-r--r--login.php40
1 files changed, 33 insertions, 7 deletions
diff --git a/login.php b/login.php
index 676f05b2..85bcd367 100644
--- a/login.php
+++ b/login.php
@@ -71,17 +71,43 @@ if ($_POST['username'] && $_POST['password']) {
$username = scrub_in($_POST['username']);
$password = scrub_in($_POST['password']);
$auth = authenticate($username, $password);
- $user = new User($username);
- if ($user->disabled === '1') {
- $auth['success'] = false;
- $auth['error'] = "Error: User Disabled please contact Admin";
- } // if user disabled
+ $user = new User($username);
+
+ if ($user->disabled == '1') {
+ $auth['success'] = false;
+ $auth['error'] = _('User Disabled please contact Admin');
+ } // if user disabled
+
+ elseif (!$user->username) {
+ /* This is run if we want to auto_create users who don't exist (usefull for non mysql auth) */
+ if (conf('auto_create')) {
+ if (!$access = conf('auto_user')) { $access = '5'; }
+
+ $name = $auth['name'];
+ $email = $auth['email'];
+
+ /* Attempt to create the user */
+ if (!$user->create($username, $name, $email,md5(time()), $access)) {
+ $auth['success'] = false;
+ $auth['error'] = _('Unable to create new account');
+ }
+ else {
+ $user = new User($username);
+ }
+ } // End if auto_create
+
+ else {
+ $auth['success'] = false;
+ $auth['error'] = _('No local account found');
+ }
+ } // else user isn't disabled
+
} // if we aren't in demo mode
-}
+
+} // if they passed a username/password
/* If the authentication was a success */
if ($auth['success']) {
-
// $auth->info are the fields specified in the config file
// to retrieve for each user
vauth_session_create($auth);