diff --git a/templates/admin.html b/templates/admin.html index ee94694..0a2dcb5 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -30,7 +30,7 @@

Admin


{{ if .Domain.SignupToken }} -
+
{{ end }} {{ end }} {{ if .ErrMsg }} @@ -46,7 +46,7 @@

Mods

{{ range .Mods }}
-
+ {{ $.csrfField }} {{ .Email }} ({{ .DisplayName }}) @@ -58,7 +58,7 @@

Mods

{{ end }}
- + {{ .csrfField }}
@@ -75,7 +75,7 @@

Mods

Categories

{{ range .Categories }}
- + {{ $.csrfField }}
@@ -104,7 +104,7 @@

Categories

{{ end }}
- + {{ .csrfField }}
diff --git a/templates/base.html b/templates/base.html index 6e78247..9506932 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,8 +7,8 @@ {{ block "title" . }}Orange Forum{{ end }} - - + +
@@ -25,15 +25,15 @@
{{ if .User }} - + {{ .User.DisplayName }} - Logout + Logout {{ else }} - + Login - Signup + Signup {{ end }}
@@ -43,6 +43,6 @@ {{ block "body" . }} {{ end }}
- + diff --git a/templates/commentedit.html b/templates/commentedit.html index 021a976..be7654d 100644 --- a/templates/commentedit.html +++ b/templates/commentedit.html @@ -7,7 +7,7 @@

{{ if .Comment }}Edit{{ else }}New{{ end }} comment

- Home / {{ .Category.Name }} / {{ .Topic.Title }} / {{ if .Comment }}Edit{{ else }}New{{ end }} comment + Home / {{ .Category.Name }} / {{ .Topic.Title }} / {{ if .Comment }}Edit{{ else }}New{{ end }} comment

diff --git a/templates/index.html b/templates/index.html index 12fd438..0c6372d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@

Categories

{{ $c.Description }} diff --git a/templates/ot_signin.html b/templates/ot_signin.html index 598c5df..43f2128 100644 --- a/templates/ot_signin.html +++ b/templates/ot_signin.html @@ -21,9 +21,9 @@

Signin

{{ .ErrMsg }}

{{ end }}

- Want to sign in with your password? Signin! + Want to sign in with your password? Signin!

- Don't have an account? Sign up! + Don't have an account? Sign up!

{{ end }} \ No newline at end of file diff --git a/templates/profile.html b/templates/profile.html index c27a0ab..30abfaf 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -31,10 +31,10 @@

User profile

{{ if .User }}
-

Change password

+

Change password

{{ end }} {{ if .User }}{{ if .User.IsSuperAdmin }} -

Admin section

+

Admin section

{{ end }}{{ end }}
{{ else }} diff --git a/templates/signin.html b/templates/signin.html index 1dee138..4afcab4 100644 --- a/templates/signin.html +++ b/templates/signin.html @@ -25,10 +25,10 @@

Signin

{{ .ErrMsg }}

{{ end }}

- Want to sign in with a one time link? + Want to sign in with a one time link?

- Don't have an account? Sign up! + Don't have an account? Sign up!

{{ .Var }} diff --git a/templates/signup.html b/templates/signup.html index 4f560bd..c24b679 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -29,6 +29,6 @@

Signup

{{ .ErrMsg }}

{{ end }}

- Already have an account? Signin! + Already have an account? Signin!

{{ end }} \ No newline at end of file diff --git a/templates/topic.html b/templates/topic.html index 4e79fa9..2d0fb7b 100644 --- a/templates/topic.html +++ b/templates/topic.html @@ -7,11 +7,11 @@

{{ .Topic.Title }}

- Home / {{ .Category.Name }} / {{ .Topic.Title }} + Home / {{ .Category.Name }} / {{ .Topic.Title }}

- + New comment @@ -24,7 +24,7 @@

{{ .Topic.Title }}

- {{ .Author.DisplayName }} + {{ .Author.DisplayName }} {{ if .Author.IsSuperMod }}   @@ -38,11 +38,11 @@

{{ .Topic.Title }}

{{ if $.User }}{{ if or $.User.IsSuperAdmin $.User.IsSuperMod (eq $.User.UserID .Topic.UserID )}} - + {{ end }}{{ end }} - +
@@ -57,7 +57,7 @@

{{ .Topic.Title }}

- {{ .DisplayName }} + {{ .DisplayName }} {{ if .IsSuperMod }}   @@ -76,11 +76,11 @@

{{ .Topic.Title }}

{{ if $.User }}{{ if or $.User.IsSuperAdmin $.User.IsSuperMod (eq $.User.UserID .UserID )}} - + {{ end }}{{ end }} - +
@@ -89,7 +89,7 @@

{{ .Topic.Title }}

{{ end }}

- + New comment diff --git a/templates/topicedit.html b/templates/topicedit.html index 353cf23..5623425 100644 --- a/templates/topicedit.html +++ b/templates/topicedit.html @@ -7,7 +7,7 @@

{{ if .Topic }}Edit{{ else }}New{{ end }} topic

- Home / {{ .Category.Name }} / {{ if .Topic }}{{ .Topic.Title }}{{ else }}New topic{{ end }} + Home / {{ .Category.Name }} / {{ if .Topic }}{{ .Topic.Title }}{{ else }}New topic{{ end }}

diff --git a/templates/topiclist.html b/templates/topiclist.html index 87be3be..4c904ce 100644 --- a/templates/topiclist.html +++ b/templates/topiclist.html @@ -4,14 +4,14 @@ {{ define "body" }} -

{{ .Category.Name }}

+

{{ .Category.Name }}

Home / {{ .Category.Name }}

- + New topic @@ -25,7 +25,7 @@

{{ .Category {{ if .IsSticky }} {{ end }} - {{ .Title }} + {{ .Title }}

Started by {{ .DisplayName }} {{ .CreatedAtStr }}   @@ -43,7 +43,7 @@

{{ .Category

{{ end }} -More +More {{ else }}

No topics found

{{ end }} diff --git a/views/admin.go b/views/admin.go index a1e1745..ee93240 100644 --- a/views/admin.go +++ b/views/admin.go @@ -55,7 +55,7 @@ func adminHandler(w http.ResponseWriter, r *http.Request) { if errMsg == "" { models.UpdateDomainByID(domain.DomainID, forumName, logo, isRegularSignupEnabled, isReadOnly, signupToken) - http.Redirect(w, r, basePath+"/admin", http.StatusSeeOther) + http.Redirect(w, r, basePath+"admin", http.StatusSeeOther) return } } @@ -101,7 +101,7 @@ func postCreateMod(w http.ResponseWriter, r *http.Request) { models.UpdateUserSuperMod(modUser.UserID, true) - http.Redirect(w, r, basePath+"/admin", http.StatusSeeOther) + http.Redirect(w, r, basePath+"admin", http.StatusSeeOther) } func postDeleteMod(w http.ResponseWriter, r *http.Request) { @@ -134,7 +134,7 @@ func postDeleteMod(w http.ResponseWriter, r *http.Request) { models.UpdateUserSuperMod(modUserID, false) - http.Redirect(w, r, basePath+"/admin", http.StatusSeeOther) + http.Redirect(w, r, basePath+"admin", http.StatusSeeOther) } func postCategory(w http.ResponseWriter, r *http.Request) { @@ -172,5 +172,5 @@ func postCategory(w http.ResponseWriter, r *http.Request) { models.UpdateCategoryByID(categoryID, name, description, isPrivate, isReadOnly, isArchived) } - http.Redirect(w, r, basePath+"/admin", http.StatusSeeOther) + http.Redirect(w, r, basePath+"admin", http.StatusSeeOther) } diff --git a/views/auth.go b/views/auth.go index 9a1c80e..cd974d6 100644 --- a/views/auth.go +++ b/views/auth.go @@ -86,9 +86,9 @@ func mustAuth(next http.Handler) http.Handler { HttpOnly: true, }) if r.Method == "GET" { - http.Redirect(w, r, basePath+"/auth/signin?next="+r.URL.Path, http.StatusSeeOther) + http.Redirect(w, r, basePath+"auth/signin?next="+r.URL.Path, http.StatusSeeOther) } else { - http.Redirect(w, r, basePath+"/", http.StatusSeeOther) + http.Redirect(w, r, basePath, http.StatusSeeOther) } }) } @@ -176,7 +176,7 @@ func postAuthOneTimeSignIn(w http.ResponseWriter, r *http.Request) { if user != nil { errMsg = "A one time sign-in link has been sent to your email" token := models.UpdateUserOneTimeLoginTokenByID(user.UserID) - link := "http://" + r.Host + basePath + "/auth/otsignin/" + token + "?next=" + next + link := "http://" + r.Host + basePath + "auth/otsignin/" + token + "?next=" + next forumName := domain.ForumName subject := forumName + " sign-in link" @@ -370,12 +370,12 @@ func postAuthChangePass(w http.ResponseWriter, r *http.Request) { func getAuthLogout(w http.ResponseWriter, r *http.Request) { basePath := r.Context().Value(ctxBasePath).(string) - http.SetCookie(w, &http.Cookie{Name: "jwt", Value: "", Path: basePath + "/", Expires: time.Now().Add(-300 * time.Hour), HttpOnly: true}) - http.SetCookie(w, &http.Cookie{Name: "csrftoken", Value: "", Path: basePath + "/", Expires: time.Now().Add(-300 * time.Hour)}) + http.SetCookie(w, &http.Cookie{Name: "jwt", Value: "", Path: basePath, Expires: time.Now().Add(-300 * time.Hour), HttpOnly: true}) + http.SetCookie(w, &http.Cookie{Name: "csrftoken", Value: "", Path: basePath, Expires: time.Now().Add(-300 * time.Hour)}) if user, ok := r.Context().Value(CtxUserKey).(*models.User); ok { models.LogOutUserByID(user.UserID) } - http.Redirect(w, r, basePath+"/", http.StatusSeeOther) + http.Redirect(w, r, basePath, http.StatusSeeOther) } func init() { diff --git a/views/domains.go b/views/domains.go index 407d7ee..d8cd39b 100644 --- a/views/domains.go +++ b/views/domains.go @@ -36,7 +36,7 @@ func domainCtx(next http.Handler) http.Handler { return } ctx := context.WithValue(r.Context(), ctxDomain, domain) - ctx2 := context.WithValue(ctx, ctxBasePath, "/forums/"+domainName) + ctx2 := context.WithValue(ctx, ctxBasePath, "/forums/"+domainName+"/") next.ServeHTTP(w, r.WithContext(ctx2)) }) } @@ -50,7 +50,7 @@ func hostCtx(next http.Handler) http.Handler { return } ctx := context.WithValue(r.Context(), ctxDomain, domain) - ctx2 := context.WithValue(ctx, ctxBasePath, "") + ctx2 := context.WithValue(ctx, ctxBasePath, "/") next.ServeHTTP(w, r.WithContext(ctx2)) }) } diff --git a/views/topics.go b/views/topics.go index a84933c..6a74fa5 100644 --- a/views/topics.go +++ b/views/topics.go @@ -127,7 +127,7 @@ func editTopic(w http.ResponseWriter, r *http.Request) { return } else if action == "Delete" { models.DeleteTopicByID(topic.TopicID, topic.UserID) - http.Redirect(w, r, basePath+"/categories/"+strconv.Itoa(category.CategoryID), http.StatusSeeOther) + http.Redirect(w, r, basePath+"categories/"+strconv.Itoa(category.CategoryID), http.StatusSeeOther) return } http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) diff --git a/views/users.go b/views/users.go index 949bf0c..b3cc533 100644 --- a/views/users.go +++ b/views/users.go @@ -80,7 +80,7 @@ func profileHandler(w http.ResponseWriter, r *http.Request) { if errMsg == "" { models.UpdateUserByID(profileUser.UserID, newEmail, newDisplayName, newIsBanned) - http.Redirect(w, r, basePath+"/users/"+strconv.Itoa(profileUser.UserID), http.StatusSeeOther) + http.Redirect(w, r, basePath+"users/"+strconv.Itoa(profileUser.UserID), http.StatusSeeOther) return } }