Skip to content

Commit

Permalink
Add automatic internal user confirmation
Browse files Browse the repository at this point in the history
At this point we want to maintain backwards compatibility
and confirm every user. Once we start sending activation
links to the selected groups of users, we'll exclude
this groups from the automatic user confirmation.

remp/crm#1741
  • Loading branch information
Zoltan Boraros authored and rootpd committed Jun 16, 2021
1 parent 2a78d20 commit 1d23ed3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/model/Repositories/UserEmailConfirmationsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function generate(int $userId)

public function confirm(string $token): ?ActiveRow
{
$emailConfirmationRow = $this->getTable()->where('token', $token)->fetch();
$emailConfirmationRow = $this->getTable()->where('token', $token)->order('id DESC')->fetch();
if (!$emailConfirmationRow) {
return null;
}
Expand All @@ -32,10 +32,14 @@ public function confirm(string $token): ?ActiveRow

return $emailConfirmationRow;
}

public function getToken(int $userId): ?string
{
$token = $this->getTable()->where('user_id', $userId)->fetchField('token');
$token = $this->getTable()
->where('user_id', $userId)
->order('id DESC')
->fetchField('token');

return $token ?: null;
}
}

0 comments on commit 1d23ed3

Please sign in to comment.