github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/web/wellknown/wellknown.go (about)

     1  package wellknown
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/cozy/cozy-stack/web/middlewares"
     7  	"github.com/labstack/echo/v4"
     8  )
     9  
    10  // ChangePassword is an handler that redirects to the settings page that can be
    11  // used by a user to change their password.
    12  // See https://w3c.github.io/webappsec-change-password-url/
    13  func ChangePassword(c echo.Context) error {
    14  	inst := middlewares.GetInstance(c)
    15  	return c.Redirect(http.StatusFound, inst.ChangePasswordURL())
    16  }
    17  
    18  // Routes sets the routing for the status service
    19  func Routes(router *echo.Group) {
    20  	router.GET("/change-password", ChangePassword)
    21  	router.HEAD("/change-password", ChangePassword)
    22  }