Removes "Create account" button allowSignup false

This commit is contained in:
Roch D'Amour 2022-02-07 23:03:42 -05:00
parent 3758eecc96
commit 598c32f67c
3 changed files with 11 additions and 6 deletions

View File

@ -1,9 +1,10 @@
package view
type LoginViewModel struct {
Success string
Error string
TotalUsers int
Success string
Error string
TotalUsers int
AllowSignup bool
}
type SetPasswordViewModel struct {

View File

@ -299,10 +299,12 @@ func (h *LoginHandler) PostResetPassword(w http.ResponseWriter, r *http.Request)
func (h *LoginHandler) buildViewModel(r *http.Request) *view.LoginViewModel {
numUsers, _ := h.userSrvc.Count()
allowSignup := h.config.Security.AllowSignup
return &view.LoginViewModel{
Success: r.URL.Query().Get("success"),
Error: r.URL.Query().Get("error"),
TotalUsers: int(numUsers),
Success: r.URL.Query().Get("success"),
Error: r.URL.Query().Get("error"),
TotalUsers: int(numUsers),
AllowSignup: allowSignup,
}
}

View File

@ -83,9 +83,11 @@
<a href="login">
<button type="button" class="btn-default">Log in</button>
</a>
{{ if eq .AllowSignup true }}
<button type="submit" class="btn-primary">
Create Account
</button>
{{ end }}
</div>
</form>
</div>