mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-20 04:24:23 -08:00
34246ee4ef
* Fixed missing oauth tables during setup. * WIP New LDAP implementation * WIP New LDAP implementation * WIP New LDAP implementation Merge remote-tracking branch 'origin/WIP_LDAP' into WIP_LDAP * WIP New LDAP implementation Added Adldap2 to handle ldap intergration. * Updated per PR quality review * Added specific LDAP settings method * Corrected version number * Added return documentation * Added imports * Changed class to be injected into controller * Updated with PR suggestions
37 lines
728 B
PHP
37 lines
728 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Traits;
|
|
|
|
trait UserTrait
|
|
{
|
|
/**
|
|
* Generate a random encrypted password.
|
|
*
|
|
* @author Wes Hulette <jwhulette@gmail.com>
|
|
*
|
|
* @since 5.0.0
|
|
*
|
|
* @return string
|
|
*/
|
|
public function generateEncyrptedPassword(): string
|
|
{
|
|
return bcrypt($this->generateUnencryptedPassword());
|
|
}
|
|
|
|
/**
|
|
* Get a random unencrypted password.
|
|
*
|
|
* @author Wes Hulette <jwhulette@gmail.com>
|
|
*
|
|
* @since 5.0.0
|
|
*
|
|
* @return string
|
|
*/
|
|
public function generateUnencryptedPassword(): string
|
|
{
|
|
return substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 20);
|
|
}
|
|
}
|