From 460ec90049edcc9a2f924fe48109ca4897b103f2 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Sat, 15 Feb 2014 13:49:38 +0600 Subject: [PATCH] Fixup behavior on uninstalled state --- pkg/handler/app.go | 7 +++++-- pkg/template/pages/login.html | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/handler/app.go b/pkg/handler/app.go index 48858e90..b0bfb1d1 100644 --- a/pkg/handler/app.go +++ b/pkg/handler/app.go @@ -47,7 +47,7 @@ func Index(w http.ResponseWriter, r *http.Request) error { // Return an HTML form for the User to login. func Login(w http.ResponseWriter, r *http.Request) error { - var settings = database.SettingsMust() + var settings, _ = database.GetSettings() data := struct { Settings *Settings @@ -78,10 +78,13 @@ func Reset(w http.ResponseWriter, r *http.Request) error { // Return an HTML form for the User to signup. func SignUp(w http.ResponseWriter, r *http.Request) error { - if !database.SettingsMust().OpenInvitations { + var settings, _ = database.GetSettings() + + if settings == nil || !settings.OpenInvitations { http.Redirect(w, r, "/login", http.StatusSeeOther) return nil } + return RenderTemplate(w, "signup.html", nil) } diff --git a/pkg/template/pages/login.html b/pkg/template/pages/login.html index 49d668b2..8c383b04 100644 --- a/pkg/template/pages/login.html +++ b/pkg/template/pages/login.html @@ -10,8 +10,8 @@
- {{ if .Settings.OpenInvitations }} - request invitation  + {{ if .Settings ne nil and .Settings.OpenInvitations }} + request invitation ยท  {{ end }} forgot password