Properly handle error and improve error messages

This commit is contained in:
2024-09-21 11:26:25 +07:00
parent 557e7313b2
commit bcdcbd5049
25 changed files with 258 additions and 234 deletions

View File

@ -20,9 +20,8 @@ import (
)
type UnverifiedUser struct {
User *models.User
Code string
CreateTime time.Time
User *models.User
Code string
}
func GET(w http.ResponseWriter, r *http.Request) {
@ -36,6 +35,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
app.Server.Logger.Error(err.Error())
return
}
return
}
func POST(w http.ResponseWriter, r *http.Request) {
@ -123,9 +123,8 @@ func verifyEmail(user *models.User) error {
}
unverifiedUser := UnverifiedUser{
User: user,
Code: code,
CreateTime: time.Now(),
User: user,
Code: code,
}
newUnverifiedUser, err := json.Marshal(unverifiedUser)
if err != nil {