ElggUser::setPassword PHP Method

setPassword() public method

Set the necessary attribute to store a hash of the user's password.
Since: 1.10.0
public setPassword ( string $password ) : void
$password string The password to be hashed
return void
    public function setPassword($password)
    {
        $this->attributes['password_hash'] = _elgg_services()->passwords->generateHash($password);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Called before each test object.
  */
 public function __construct()
 {
     parent::__construct();
     $this->user = new \ElggUser();
     $this->user->username = '******' . rand();
     $this->user->email = '*****@*****.**' . rand();
     $this->user->name = 'fake user ' . rand();
     $this->user->access_id = ACCESS_PUBLIC;
     $this->user->setPassword(rand());
     $this->user->owner_guid = 0;
     $this->user->container_guid = 0;
     $this->user->save();
 }
All Usage Examples Of ElggUser::setPassword