refactor: rename email back to username

This commit is contained in:
Stavros
2025-01-26 18:29:30 +02:00
parent 708006decf
commit 989ea8f229
12 changed files with 58 additions and 58 deletions

View File

@@ -18,9 +18,9 @@ type Auth struct {
OAuthWhitelist []string
}
func (auth *Auth) GetUser(email string) *types.User {
func (auth *Auth) GetUser(username string) *types.User {
for _, user := range auth.Users {
if user.Email == email {
if user.Username == username {
return &user
}
}
@@ -28,7 +28,7 @@ func (auth *Auth) GetUser(email string) *types.User {
}
func (auth *Auth) CheckPassword(user types.User, password string) bool {
hashedPasswordErr := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))
hashedPasswordErr := bcrypt.CompareHashAndPassword([]byte(user.Username), []byte(password))
return hashedPasswordErr == nil
}