mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
implement social auto registration feature
This commit is contained in:
committed by
Ibrahim Ennafaa
parent
01260d95f3
commit
fe6dfcedf9
@@ -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
|
||||
@@ -143,13 +144,14 @@ class UserRepo
|
||||
* @param array $data
|
||||
* @return User
|
||||
*/
|
||||
public function create(array $data)
|
||||
public function create(array $data, $autoVerifyEmail)
|
||||
{
|
||||
|
||||
return $this->user->forceCreate([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
'email_confirmed' => false
|
||||
'email_confirmed' => $autoVerifyEmail
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -259,4 +261,4 @@ class UserRepo
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user