mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-08 17:14:33 +00:00

* fix: password complexity policy * feat: check password policy * feat: check password policy * fix: password policy on password change * fix: remove double policy check * feat: check pw policy on register * feat: check pw policy on init * fix: hover on secondary buttons * fix: use data set instead of hidden inputs * fix: disabled button * fix: en login * fix: read policy * feat: check if org exists * multiple checks * feat: validate all forms * fix: check all forms * fix: remove unused err Co-authored-by: Livio Amstutz <livio.a@gmail.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/caos/zitadel/internal/auth_request/model"
|
|
)
|
|
|
|
const (
|
|
tmplPassword = "password"
|
|
)
|
|
|
|
type passwordFormData struct {
|
|
Password string `schema:"password"`
|
|
}
|
|
|
|
func (l *Login) renderPassword(w http.ResponseWriter, r *http.Request, authReq *model.AuthRequest, err error) {
|
|
var errType, errMessage string
|
|
if err != nil {
|
|
errMessage = l.getErrorMessage(r, err)
|
|
}
|
|
data := userData{
|
|
baseData: l.getBaseData(r, authReq, "Password", errType, errMessage),
|
|
LoginName: authReq.LoginName,
|
|
}
|
|
l.renderer.RenderTemplate(w, r, l.renderer.Templates[tmplPassword], data, nil)
|
|
}
|
|
|
|
func (l *Login) handlePasswordCheck(w http.ResponseWriter, r *http.Request) {
|
|
data := new(passwordFormData)
|
|
authReq, err := l.getAuthRequestAndParseData(r, data)
|
|
if err != nil {
|
|
l.renderError(w, r, authReq, err)
|
|
return
|
|
}
|
|
err = l.authRepo.VerifyPassword(setContext(r.Context(), authReq.UserOrgID), authReq.ID, authReq.UserID, data.Password, model.BrowserInfoFromRequest(r))
|
|
if err != nil {
|
|
l.renderPassword(w, r, authReq, err)
|
|
return
|
|
}
|
|
l.renderNextStep(w, r, authReq)
|
|
}
|