chore: extract mail to it's own service
This commit is contained in:
@@ -76,7 +76,7 @@ func (handler HandlerAuthImpl) handleSignIn() http.HandlerFunc {
|
||||
http.Error(w, "Invalid email or password", http.StatusUnauthorized)
|
||||
} else {
|
||||
utils.LogError("Error signing in", err)
|
||||
http.Error(w, "An error occurred", http.StatusInternalServerError)
|
||||
http.Error(w, "InternalServerErr", http.StatusInternalServerError)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
11
handler/auth_test.go
Normal file
11
handler/auth_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandleSignIn(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("should signIn and return session cookie", func(t *testing.T) {
|
||||
})
|
||||
}
|
||||
@@ -400,7 +400,8 @@ func HandleDeleteAccountComp(db *sql.DB, serverSettings *types.ServerSettings) h
|
||||
return
|
||||
}
|
||||
|
||||
go mailService.SendMail(user.Email, "Account deleted", "Your account has been deleted")
|
||||
//TODO
|
||||
// go utils.SendMail(user.Email, "Account deleted", "Your account has been deleted")
|
||||
|
||||
utils.DoRedirect(w, r, "/")
|
||||
}
|
||||
@@ -579,7 +580,8 @@ func HandleResetPasswordComp(db *sql.DB, serverSettings *types.ServerSettings) h
|
||||
utils.TriggerToast(w, r, "error", "Internal Server Error")
|
||||
return
|
||||
}
|
||||
mailService.SendMail(email, "Reset Password", mail.String())
|
||||
//TODO
|
||||
// utils.SendMail(email, "Reset Password", mail.String())
|
||||
}
|
||||
|
||||
utils.TriggerToast(w, r, "info", "If the email exists, an email has been sent")
|
||||
@@ -615,8 +617,8 @@ func sendVerificationEmail(db *sql.DB, userId string, email string, serverSettin
|
||||
utils.LogError("Could not render welcome email", err)
|
||||
return
|
||||
}
|
||||
mailService := NewMailService(serverSettings)
|
||||
mailService.SendMail(email, "Welcome to ME-FIT", w.String())
|
||||
//TODO
|
||||
// utils.SendMail(email, "Welcome to ME-FIT", w.String())
|
||||
}
|
||||
|
||||
func TryCreateSessionAndSetCookie(r *http.Request, w http.ResponseWriter, db *sql.DB, user_uuid uuid.UUID) error {
|
||||
|
||||
Reference in New Issue
Block a user