mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 14:09:43 -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("Local user ".$request->input('username')." does not exist");
|
||||||
Log::debug("Creating local user ".$request->input('username'));
|
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.");
|
Log::debug("Local user created.");
|
||||||
} else {
|
} else {
|
||||||
Log::debug("Could not create local user.");
|
Log::debug("Could not create local user.");
|
||||||
|
|
|
@ -233,7 +233,7 @@ class Ldap extends Model
|
||||||
* @param $ldapatttibutes
|
* @param $ldapatttibutes
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
public static function createUserFromLdap($ldapatttibutes)
|
public static function createUserFromLdap($ldapatttibutes, $password)
|
||||||
{
|
{
|
||||||
$item = self::parseAndMapLdapAttributes($ldapatttibutes);
|
$item = self::parseAndMapLdapAttributes($ldapatttibutes);
|
||||||
|
|
||||||
|
@ -246,7 +246,8 @@ class Ldap extends Model
|
||||||
$user->email = $item['email'];
|
$user->email = $item['email'];
|
||||||
|
|
||||||
if (Setting::getSettings()->ldap_pw_sync == '1') {
|
if (Setting::getSettings()->ldap_pw_sync == '1') {
|
||||||
$user->password = bcrypt(Input::get('password'));
|
|
||||||
|
$user->password = bcrypt($password);
|
||||||
} else {
|
} else {
|
||||||
$pass = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 25);
|
$pass = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 25);
|
||||||
$user->password = bcrypt($pass);
|
$user->password = bcrypt($pass);
|
||||||
|
|
Loading…
Reference in a new issue