feat: email verification flow (not 100% complete)

This commit is contained in:
Florian Sylvain
2024-05-15 12:04:30 +02:00
parent 37647e60d9
commit c929acd4ab
11 changed files with 126 additions and 24 deletions
+1
View File
@@ -7,4 +7,5 @@ type IUserRepository interface {
GetByUsername(username string) (user.User, error)
GetAll() []user.User
Create(user user.User) (user.User, error)
UpdateVerificationStatus(userId uint32, isVerified bool) (user.User, error)
}
+2 -1
View File
@@ -22,13 +22,14 @@ func FromApi(
email string,
verificationCode string,
) User {
expiration := time.Now().Add(2 * time.Hour)
return User{
Username: username,
Password: password,
Email: email,
IsVerified: false,
VerificationCode: verificationCode,
VerificationExpiration: time.Now().Add(2 * time.Hour),
VerificationExpiration: expiration,
}
}