diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index f53aa02995..3ee323377d 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -185,7 +185,7 @@ class LoginController extends Controller Log::debug("Local user ".$request->input('username')." does not exist"); Log::debug("Creating local user ".$request->input('username')); - if ($user = Ldap::createUserFromLdap($ldap_user)) { //this handles passwords on its own + if ($user = Ldap::createUserFromLdap($ldap_user, $request->input('password'))) { Log::debug("Local user created."); } else { Log::debug("Could not create local user."); diff --git a/app/Models/Ldap.php b/app/Models/Ldap.php index 6aa87461fc..025e759798 100644 --- a/app/Models/Ldap.php +++ b/app/Models/Ldap.php @@ -233,7 +233,7 @@ class Ldap extends Model * @param $ldapatttibutes * @return array|bool */ - public static function createUserFromLdap($ldapatttibutes) + public static function createUserFromLdap($ldapatttibutes, $password) { $item = self::parseAndMapLdapAttributes($ldapatttibutes); @@ -246,7 +246,8 @@ class Ldap extends Model $user->email = $item['email']; if (Setting::getSettings()->ldap_pw_sync == '1') { - $user->password = bcrypt(Input::get('password')); + + $user->password = bcrypt($password); } else { $pass = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 25); $user->password = bcrypt($pass);