diff --git a/changelog/unreleased/password-reset-link.md b/changelog/unreleased/password-reset-link.md
new file mode 100644
index 00000000000..01b57657ce8
--- /dev/null
+++ b/changelog/unreleased/password-reset-link.md
@@ -0,0 +1,7 @@
+Enhancement: Add password reset link to login page
+
+Added a configurable passwort reset link to the login page.
+It can be set via `IDP_PASSWORD_RESET_URI`. If the option is not set
+the link will not be shown.
+
+https://github.com/owncloud/ocis/pull/3329
diff --git a/idp/pkg/config/service.go b/idp/pkg/config/service.go
index c019b73046e..261a336e2ba 100644
--- a/idp/pkg/config/service.go
+++ b/idp/pkg/config/service.go
@@ -2,5 +2,6 @@ package config
// Service defines the available service configuration.
type Service struct {
- Name string `ocisConfig:"-" yaml:"-"`
+ Name string `ocisConfig:"-" yaml:"-"`
+ PasswordResetURI string `ocisConfig:"password_reset_uri" env:"IDP_PASSWORD_RESET_URI" desc:"The URI where a user can reset their password."`
}
diff --git a/idp/pkg/service/v0/service.go b/idp/pkg/service/v0/service.go
index cf486f16214..0598f0b59d3 100644
--- a/idp/pkg/service/v0/service.go
+++ b/idp/pkg/service/v0/service.go
@@ -214,6 +214,8 @@ func (idp IDP) Index() http.HandlerFunc {
nonce := rndm.GenerateRandomString(32)
indexHTML = bytes.Replace(indexHTML, []byte("__CSP_NONCE__"), []byte(nonce), 1)
+ indexHTML = bytes.Replace(indexHTML, []byte("__PASSWORD_RESET_LINK__"), []byte(idp.config.Service.PasswordResetURI), 1)
+
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
if _, err := w.Write(indexHTML); err != nil {
diff --git a/idp/ui/public/index.html b/idp/ui/public/index.html
index 9896a1a725a..1004a430603 100644
--- a/idp/ui/public/index.html
+++ b/idp/ui/public/index.html
@@ -13,6 +13,6 @@
-
+