account refactor
This commit is contained in:
@@ -142,7 +142,24 @@ readonly class AuthService
|
||||
{
|
||||
$name = (new Name($name));
|
||||
$this->userRepo->updateName($this->currentUserId(), $name);
|
||||
$user = $this->userRepo->findById($this->currentUserId());
|
||||
$this->session->put(["user" => $user->get()->safe()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws LucentException
|
||||
*/
|
||||
public function updateEmail(string $email): void
|
||||
{
|
||||
$email = (new Email($email));
|
||||
$user = $this->userRepo->findByEmail($email);
|
||||
if($user->isDefined()){
|
||||
throw new LucentException("Email already assigned to user");
|
||||
}
|
||||
|
||||
$this->userRepo->updateEmail($this->currentUserId(), $email);
|
||||
$user = $this->userRepo->findById($this->currentUserId());
|
||||
$this->session->put(["user" => $user->get()->safe()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user