mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Remove "Create Account" button when AllowSignup is set to false (#319)
Merge pull request #319
This commit is contained in:
parent
3758eecc96
commit
ac9d96c563
@ -1,9 +1,10 @@
|
|||||||
package view
|
package view
|
||||||
|
|
||||||
type LoginViewModel struct {
|
type LoginViewModel struct {
|
||||||
Success string
|
Success string
|
||||||
Error string
|
Error string
|
||||||
TotalUsers int
|
TotalUsers int
|
||||||
|
AllowSignup bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetPasswordViewModel struct {
|
type SetPasswordViewModel struct {
|
||||||
|
@ -299,10 +299,12 @@ func (h *LoginHandler) PostResetPassword(w http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
func (h *LoginHandler) buildViewModel(r *http.Request) *view.LoginViewModel {
|
func (h *LoginHandler) buildViewModel(r *http.Request) *view.LoginViewModel {
|
||||||
numUsers, _ := h.userSrvc.Count()
|
numUsers, _ := h.userSrvc.Count()
|
||||||
|
allowSignup := h.config.Security.AllowSignup
|
||||||
|
|
||||||
return &view.LoginViewModel{
|
return &view.LoginViewModel{
|
||||||
Success: r.URL.Query().Get("success"),
|
Success: r.URL.Query().Get("success"),
|
||||||
Error: r.URL.Query().Get("error"),
|
Error: r.URL.Query().Get("error"),
|
||||||
TotalUsers: int(numUsers),
|
TotalUsers: int(numUsers),
|
||||||
|
AllowSignup: allowSignup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,10 @@ body {
|
|||||||
@apply py-2 px-4 font-semibold rounded bg-gray-800 hover:bg-gray-850 text-white text-sm;
|
@apply py-2 px-4 font-semibold rounded bg-gray-800 hover:bg-gray-850 text-white text-sm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-disabled {
|
||||||
|
@apply py-2 px-4 font-semibold rounded bg-gray-800 text-gray-600 text-sm;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
@apply py-2 px-4 font-semibold rounded bg-green-700 hover:bg-green-800 text-white text-sm;
|
@apply py-2 px-4 font-semibold rounded bg-green-700 hover:bg-green-800 text-white text-sm;
|
||||||
}
|
}
|
||||||
@ -92,4 +96,4 @@ body {
|
|||||||
::-webkit-calendar-picker-indicator {
|
::-webkit-calendar-picker-indicator {
|
||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -31,9 +31,15 @@
|
|||||||
Forgot password?
|
Forgot password?
|
||||||
</a>
|
</a>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
|
{{ if eq .AllowSignup true }}
|
||||||
<a href="signup">
|
<a href="signup">
|
||||||
<button type="button" class="btn-default">Sign up</button>
|
<button type="button" class="btn-default">Sign up</button>
|
||||||
</a>
|
</a>
|
||||||
|
{{ else }}
|
||||||
|
<a title="The administrator of this instance has disabled sign up.">
|
||||||
|
<button type="button" class="btn-disabled" disabled > Sign up </button>
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
<button type="submit" class="btn-primary">Log in</button>
|
<button type="submit" class="btn-primary">Log in</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -46,4 +52,4 @@
|
|||||||
{{ template "foot.tpl.html" . }}
|
{{ template "foot.tpl.html" . }}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -83,9 +83,15 @@
|
|||||||
<a href="login">
|
<a href="login">
|
||||||
<button type="button" class="btn-default">Log in</button>
|
<button type="button" class="btn-default">Log in</button>
|
||||||
</a>
|
</a>
|
||||||
|
{{ if eq .AllowSignup true }}
|
||||||
<button type="submit" class="btn-primary">
|
<button type="submit" class="btn-primary">
|
||||||
Create Account
|
Create Account
|
||||||
</button>
|
</button>
|
||||||
|
{{ else }}
|
||||||
|
<button type="submit" class="btn-disabled" disabled title="The administrator of this instance has disabled sign up.">
|
||||||
|
Create Account
|
||||||
|
</button>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -97,4 +103,4 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user