fix: move signin handler #181
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 47s
Build and Push Docker Image / Explore-Gitea-Actions (push) Successful in 51s

This commit was merged in pull request #198.
This commit is contained in:
2024-10-03 23:23:16 +02:00
parent cc3747b226
commit cbf5b39294
4 changed files with 31 additions and 27 deletions

View File

@@ -77,27 +77,7 @@ func (service ServiceAuthImpl) SignIn(email string, password string) (*User, err
return NewUser(user), nil
}
func HandleSignInPage(db *sql.DB, serverSettings *types.ServerSettings) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user := utils.GetUserFromSession(db, r)
if user == nil {
userComp := UserInfoComp(nil)
signIn := auth.SignInOrUpComp(true)
err := template.Layout(signIn, userComp, serverSettings.Environment).Render(r.Context(), w)
if err != nil {
utils.LogError("Failed to render sign in page", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
}
} else if !user.EmailVerified {
utils.DoRedirect(w, r, "/auth/verify")
} else {
utils.DoRedirect(w, r, "/")
}
}
}
// TODO
func HandleSignUpPage(db *sql.DB, serverSettings *types.ServerSettings) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {