This commit is contained in:
@@ -59,7 +59,7 @@ var (
|
||||
|
||||
func (handler AuthImpl) handleSignInPage() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session != nil {
|
||||
if !session.User.EmailVerified {
|
||||
utils.DoRedirect(w, r, "/auth/verify")
|
||||
@@ -122,7 +122,7 @@ func (handler AuthImpl) handleSignIn() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleSignUpPage() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
|
||||
if session != nil {
|
||||
if !session.User.EmailVerified {
|
||||
@@ -140,7 +140,7 @@ func (handler AuthImpl) handleSignUpPage() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleSignUpVerifyPage() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
@@ -158,7 +158,7 @@ func (handler AuthImpl) handleSignUpVerifyPage() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleVerifyResendComp() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
@@ -221,7 +221,7 @@ func (handler AuthImpl) handleSignUp() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleSignOut() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
|
||||
if session != nil {
|
||||
err := handler.service.SignOut(session.Id)
|
||||
@@ -248,9 +248,10 @@ func (handler AuthImpl) handleSignOut() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleDeleteAccountPage() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
}
|
||||
|
||||
comp := auth.DeleteAccountComp()
|
||||
@@ -260,7 +261,7 @@ func (handler AuthImpl) handleDeleteAccountPage() http.HandlerFunc {
|
||||
|
||||
func (handler AuthImpl) handleDeleteAccountComp() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
@@ -289,7 +290,7 @@ func (handler AuthImpl) handleChangePasswordPage() http.HandlerFunc {
|
||||
|
||||
isPasswordReset := r.URL.Query().Has("token")
|
||||
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
|
||||
if session == nil && !isPasswordReset {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
@@ -304,7 +305,7 @@ func (handler AuthImpl) handleChangePasswordPage() http.HandlerFunc {
|
||||
func (handler AuthImpl) handleChangePasswordComp() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
@@ -326,7 +327,7 @@ func (handler AuthImpl) handleChangePasswordComp() http.HandlerFunc {
|
||||
func (handler AuthImpl) handleResetPasswordPage() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
session := r.Context().Value(middleware.SessionKey).(*service.Session)
|
||||
session := middleware.GetSession(r)
|
||||
if session == nil {
|
||||
utils.DoRedirect(w, r, "/auth/signin")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user