Implement user login with password hash verification and username lookup

This commit is contained in:
2025-05-15 12:24:48 +03:30
parent b3fae6b80c
commit d646515776
5 changed files with 39 additions and 8 deletions
+6
View File
@@ -15,4 +15,10 @@ func NewUserService(db *gorm.DB) *UserService {
func (us *UserService) CreateUser(user models.ComUser) int {
return int(us.db.Create(&user).RowsAffected)
}
func (us *UserService) GetUserByUsername(username string) models.ComUser {
var user models.ComUser
us.db.Where("username = ?", username).First(&user)
return user
}