mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Pass the password along directly instead of retrieving it from the Input or Request
This commit is contained in:
parent
93e509bd79
commit
6c86a28d18
|
@ -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.");
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue