New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(web): custom reset password link #2854
Conversation
Thanks for choosing to contribute @you1996. We lint all PR's with golangci-lint and eslint, I may add a review to your PR with some suggestions. You are free to apply the changes if you're comfortable, alternatively you are welcome to ask a team member for advice. ArtifactsThese changes once approved by a team member will be published for testing on Buildkite, DockerHub and GitHub Container Registry. Docker Container
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So all looks fine to me. Just one suggestion around simplifying the configuration and something that will allow us to group other related options. I'll merge master into this branch and provide an example of how to utilize a URL struct in the config.
Edit: Seems I don't have permission to merge master into this. Please do so and you'll be able to use url.URL as in the configuration struct.
@@ -33,6 +33,17 @@ | |||
validator.Push(fmt.Errorf(errFmtAuthBackendRefreshInterval, config.RefreshInterval, err)) | |||
} | |||
} | |||
|
|||
if configuration.EnableExternalResetPassword && !configuration.DisableResetPassword { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
undeclared name: configuration
(typecheck)
@@ -33,6 +33,17 @@ | |||
validator.Push(fmt.Errorf(errFmtAuthBackendRefreshInterval, config.RefreshInterval, err)) | |||
} | |||
} | |||
|
|||
if configuration.EnableExternalResetPassword && !configuration.DisableResetPassword { | |||
validator.Push(errors.New("You cannot enable both `internal reset password` and `external reset password` processes in `authentication_backend`")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
undeclared name: errors
(typecheck)
validator.Push(errors.New("You cannot enable both `internal reset password` and `external reset password` processes in `authentication_backend`")) | ||
} | ||
|
||
if configuration.EnableExternalResetPassword { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
undeclared name: configuration
(typecheck)
} | ||
|
||
if configuration.EnableExternalResetPassword { | ||
err := utils.IsStringAbsURL(configuration.ExternalResetPasswordURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
undeclared name: configuration
(typecheck)
@@ -230,6 +230,19 @@ | |||
suite.Assert().False(suite.validator.HasErrors()) | |||
} | |||
|
|||
func (suite *FileBasedAuthenticationBackend) TestShouldRaiseErrorWhenResetURLIsInvalid() { | |||
suite.configuration.EnableExternalResetPassword = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
suite.configuration undefined (type *FileBasedAuthenticationBackend has no field or method configuration) (typecheck)
@@ -230,6 +230,19 @@ | |||
suite.Assert().False(suite.validator.HasErrors()) | |||
} | |||
|
|||
func (suite *FileBasedAuthenticationBackend) TestShouldRaiseErrorWhenResetURLIsInvalid() { | |||
suite.configuration.EnableExternalResetPassword = true | |||
suite.configuration.DisableResetPassword = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
suite.configuration undefined (type *FileBasedAuthenticationBackend has no field or method configuration) (typecheck)
func (suite *FileBasedAuthenticationBackend) TestShouldRaiseErrorWhenResetURLIsInvalid() { | ||
suite.configuration.EnableExternalResetPassword = true | ||
suite.configuration.DisableResetPassword = true | ||
suite.configuration.ExternalResetPasswordURL = "example.com" //nolint:goconst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
suite.configuration undefined (type *FileBasedAuthenticationBackend has no field or method configuration) (typecheck)
suite.configuration.DisableResetPassword = true | ||
suite.configuration.ExternalResetPasswordURL = "example.com" //nolint:goconst | ||
|
||
ValidateAuthenticationBackend(&suite.configuration, suite.validator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
suite.configuration undefined (type *FileBasedAuthenticationBackend has no field or method configuration) (typecheck)
Hello james, thank you for the review, merge done. |
Nice one! You'll have to change the references in the validator from |
Did you get around to those fixes? Once I merge all the other 4.35.0 images I am hoping this is ready or I'll have to fix it up myself. I'd appreciate if I can push to this branch if you don't have time to fix this up, though I can manually takeover this PR worst case scenario, you can enable this by clicking this checkbox: |
This allows providing a custom URL for password resets. If provided the disable_reset_password option is ignored, the password reset API is disabled, and the button provided in the UI to reset the password redirects users to the configured endpoint. Closes #1934, Closes #2854 Co-authored-by: you1996 <youssri@flyweight.tech>
feat(authentication): custom reset password URL
Administrators can now redirect users to their custom password reset portal and configure authelia to do so by disabling the internal password reset procedure and enabling the option to use an external portal in the case of some businesses who employ one.
Fixes #1934.