Basic user management

This commit is contained in:
2026-02-05 00:46:22 +01:00
parent e280fcfba8
commit 11108bdfcc
55 changed files with 1524 additions and 54 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Repositories;
use App\Models\User;
use DateTime;
class UserRepository {
public function findByUsername(string $username) : ?User {
return User::where(['username' => $username])->first();
}
public function checkVerificationToken(User $user, string $token) : bool {
if (new DateTime() > DateTime::createFromFormat('Y-m-d H:i:s', $user->activation_token_expires_at)) {
return false;
}
return $token === $user->activation_token;
}
}