1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Merge branch 'feature/autoregistration_social_login' of git://github.com/ibrahimennafaa/BookStack into ibrahimennafaa-feature/autoregistration_social_login

This commit is contained in:
Dan Brown
2018-09-21 16:14:52 +01:00
4 changed files with 50 additions and 6 deletions

View File

@ -76,14 +76,15 @@ class UserRepo
return $query->paginate($count);
}
/**
/**
* Creates a new user and attaches a role to them.
* @param array $data
* @param boolean autoVerifyEmail
* @return User
*/
public function registerNew(array $data)
public function registerNew(array $data, $autoVerifyEmail=false)
{
$user = $this->create($data);
$user = $this->create($data, $autoVerifyEmail);
$this->attachDefaultRole($user);
// Get avatar from gravatar and save
@ -141,15 +142,17 @@ class UserRepo
/**
* Create a new basic instance of user.
* @param array $data
* @param boolean $autoVerifyEmail
* @return User
*/
public function create(array $data)
public function create(array $data, $autoVerifyEmail=false)
{
return $this->user->forceCreate([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'email_confirmed' => false
'email_confirmed' => $autoVerifyEmail
]);
}