Skip to content

Commit 6782aa0

Browse files
committed
debug
1 parent 25a429a commit 6782aa0

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/Service/UserManager.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,21 @@ public function createAdminUserIfNotExists()
164164
public function hasRole($email, $roles)
165165
{
166166
/** @var User $user */
167-
$user = $this->entityManager->getRepository(User::class)->findOneByEmail($email);
167+
$user = $this->getUserByEmail($email);
168168
if(in_array($user->getRoleName(),$roles, true)) {
169169
return true;
170170
}
171171
return false;
172172
}
173173

174174
/**
175-
* Checks whether an active user with given email address already exists in the database.
175+
* Checks whether an active user with given email address already exists in the database.
176+
* @param string $email
177+
* @return bool
176178
*/
177-
public function checkUserExists($email) {
179+
public function checkUserExists(string $email) {
178180

179-
$user = $this->entityManager->getRepository(User::class)
180-
->findOneByEmail($email);
181+
$user = $this->getUserByEmail($email);
181182

182183
return $user !== null;
183184
}
@@ -268,6 +269,10 @@ public function getUserByPasswordResetToken(string $passwordResetToken) {
268269
return $this->entityManager->getRepository(User::class)
269270
->findOneByPasswordResetToken($passwordResetToken);
270271
}
272+
public function getUserByEmail(string $email){
273+
return $this->entityManager->getRepository(User::class)
274+
->findOneByEmail($email);
275+
}
271276

272277
/**
273278
* This method sets new password by password reset token.

0 commit comments

Comments
 (0)