web UI/REST API: add password reset

In order to reset the password from the admin/client user interface,
an SMTP configuration must be added and the user/admin must have an email
address.
You can prohibit the reset functionality on a per-user basis by using a
specific restriction.

Fixes #597
This commit is contained in:
Nicola Murino
2021-11-13 13:25:43 +01:00
parent b331dc5686
commit 78233ff9a3
25 changed files with 1787 additions and 60 deletions

View File

@@ -16,17 +16,21 @@ const (
redactedSecret = "[**redacted**]"
csrfFormToken = "_form_token"
csrfHeaderToken = "X-CSRF-TOKEN"
templateCommonDir = "common"
templateTwoFactor = "twofactor.html"
templateTwoFactorRecovery = "twofactor-recovery.html"
templateForgotPassword = "forgot-password.html"
templateResetPassword = "reset-password.html"
)
type loginPage struct {
CurrentURL string
Version string
Error string
CSRFToken string
StaticURL string
AltLoginURL string
CurrentURL string
Version string
Error string
CSRFToken string
StaticURL string
AltLoginURL string
ForgotPwdURL string
}
type twoFactorPage struct {
@@ -38,6 +42,22 @@ type twoFactorPage struct {
RecoveryURL string
}
type forgotPwdPage struct {
CurrentURL string
Error string
CSRFToken string
StaticURL string
Title string
}
type resetPwdPage struct {
CurrentURL string
Error string
CSRFToken string
StaticURL string
Title string
}
func getSliceFromDelimitedValues(values, delimiter string) []string {
result := []string{}
for _, v := range strings.Split(values, delimiter) {