mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
feat(handlers): synology password complexity err on reset (#2083)
This responds to the client with the correct error when used with Synology LDAP servers.
This commit is contained in:
parent
9e836d990c
commit
fcfff9748c
|
@ -44,8 +44,13 @@ const mfaValidationFailedMessage = "Authentication failed, please retry later."
|
||||||
|
|
||||||
const ldapPasswordComplexityCode = "0000052D."
|
const ldapPasswordComplexityCode = "0000052D."
|
||||||
|
|
||||||
var ldapPasswordComplexityCodes = []string{"0000052D"}
|
var ldapPasswordComplexityCodes = []string{
|
||||||
var ldapPasswordComplexityErrors = []string{"LDAP Result Code 19 \"Constraint Violation\": Password fails quality checking policy"}
|
"0000052D", "SynoNumber", "SynoMixedCase", "SynoExcludeNameDesc", "SynoSpecialChar",
|
||||||
|
}
|
||||||
|
var ldapPasswordComplexityErrors = []string{
|
||||||
|
"LDAP Result Code 19 \"Constraint Violation\": Password fails quality checking policy",
|
||||||
|
"LDAP Result Code 19 \"Constraint Violation\": Password is too young to change",
|
||||||
|
}
|
||||||
|
|
||||||
const testInactivity = "10"
|
const testInactivity = "10"
|
||||||
const testRedirectionURL = "http://redirection.local"
|
const testRedirectionURL = "http://redirection.local"
|
||||||
|
|
|
@ -31,9 +31,8 @@ func ResetPasswordPost(ctx *middlewares.AutheliaCtx) {
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case utils.IsStringInSliceContains(err.Error(), ldapPasswordComplexityCodes):
|
case utils.IsStringInSliceContains(err.Error(), ldapPasswordComplexityCodes),
|
||||||
ctx.Error(fmt.Errorf("%s", err), ldapPasswordComplexityCode)
|
utils.IsStringInSliceContains(err.Error(), ldapPasswordComplexityErrors):
|
||||||
case utils.IsStringInSliceContains(err.Error(), ldapPasswordComplexityErrors):
|
|
||||||
ctx.Error(fmt.Errorf("%s", err), ldapPasswordComplexityCode)
|
ctx.Error(fmt.Errorf("%s", err), ldapPasswordComplexityCode)
|
||||||
default:
|
default:
|
||||||
ctx.Error(fmt.Errorf("%s", err), unableToResetPasswordMessage)
|
ctx.Error(fmt.Errorf("%s", err), unableToResetPasswordMessage)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user