diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-14 17:29:07 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-14 17:29:07 +0000 |
commit | 78167c02518ff9d757741f0e8df524da300d067d (patch) | |
tree | d5fbbc41f6e807439de0d34ca9a06616dd961d04 /login.php | |
parent | 9a16ee2c2ce55e7693c9432be2466210a0ebc6df (diff) | |
download | ampache-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.php | 40 |
1 files changed, 33 insertions, 7 deletions
@@ -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); |