Skip to content

Commit

Permalink
Handle close settings page on success query param authgear#3813
Browse files Browse the repository at this point in the history
  • Loading branch information
IniZio committed Feb 23, 2024
1 parent f675193 commit ab8fa9d
Show file tree
Hide file tree
Showing 9 changed files with 901 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/auth/handler/webapp/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var DependencySet = wire.NewSet(
wire.Struct(new(SettingsChangeSecondaryPasswordHandler), "*"),
wire.Struct(new(SettingsDeleteAccountHandler), "*"),
wire.Struct(new(SettingsDeleteAccountSuccessHandler), "*"),
wire.Struct(new(SettingsCloseHandler), "*"),
wire.Struct(new(SettingsPasskeyHandler), "*"),
wire.Struct(new(AccountStatusHandler), "*"),
wire.Struct(new(LogoutHandler), "*"),
Expand Down
1 change: 1 addition & 0 deletions pkg/auth/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ func NewRouter(p *deps.RootProvider, configSource *configsource.ConfigSource) *h
router.Add(webapphandler.ConfigureSettingsChangePasswordRoute(webappSettingsSubRoutesRoute), p.Handler(newWebAppSettingsChangePasswordHandler))
router.Add(webapphandler.ConfigureSettingsChangeSecondaryPasswordRoute(webappSettingsSubRoutesRoute), p.Handler(newWebAppSettingsChangeSecondaryPasswordHandler))
router.Add(webapphandler.ConfigureSettingsDeleteAccountRoute(webappSettingsSubRoutesRoute), p.Handler(newWebAppSettingsDeleteAccountHandler))
router.Add(webapphandler.ConfigureSettingsCloseRoute(webappSettingsSubRoutesRoute), p.Handler(newWebAppSettingsCloseHandler))

router.Add(webapphandler.ConfigureTesterRoute(webappTesterRouter), p.Handler(newWebAppTesterHandler))

Expand Down
5 changes: 5 additions & 0 deletions pkg/auth/webapp/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func DeriveSettingsRedirectURIFromRequest(r *http.Request, defaultURI string) st
// 2. Default redirect URL
// 3. `/settings`
redirectURIFromQuery := func() string {
closeOnSuccess := r.URL.Query().Get("close_on_success")
if closeOnSuccess == "true" {
return "/settings/close"
}

redirectURI := r.URL.Query().Get("redirect_uri")
allowed := false

Expand Down
Loading

0 comments on commit ab8fa9d

Please sign in to comment.