Fixup behavior on uninstalled state

This commit is contained in:
Vsevolod Strukchinsky 2014-02-15 13:49:38 +06:00
parent 0bd8ef28dd
commit 460ec90049
2 changed files with 7 additions and 4 deletions

View file

@ -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)
}

View file

@ -10,8 +10,8 @@
<input type="submit" value="Sign in" />
</div>
<div>
{{ if .Settings.OpenInvitations }}
<a href="/signup">request invitation</a>&nbsp;
{{ if .Settings ne nil and .Settings.OpenInvitations }}
<a href="/signup">request invitation</a>&nbsp;·&nbsp;
{{ end }}
<a href="/forgot">forgot password</a>
</div>