From 9615a9153a6130d7b61710dff204c35689a5d8fd Mon Sep 17 00:00:00 2001 From: Mumbi Francis Date: Fri, 16 Jun 2023 14:20:13 +0300 Subject: [PATCH] Redirect user to webapp one upon successful signup If the authorize client isn't trusted, the user is taken to authorize-client page --- .../auth/oauth2-authorize-client.yaml | 2 +- server/app/boot_auth.go | 4 ++++ server/auth/assets/templates/inc_nav.html.tpl | 13 +------------ server/auth/handlers/handle_signup.go | 19 +++++++++++++++++-- server/auth/handlers/links.go | 1 + 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/locale/en/corteza-server/auth/oauth2-authorize-client.yaml b/locale/en/corteza-server/auth/oauth2-authorize-client.yaml index a4077e0b9..a4a618496 100644 --- a/locale/en/corteza-server/auth/oauth2-authorize-client.yaml +++ b/locale/en/corteza-server/auth/oauth2-authorize-client.yaml @@ -11,4 +11,4 @@ template: errors: invalid-user: Cannot continue with unauthorized email, visit your profile and resolve the issue. alerts: - denied: cannot authorize {{client}}, no permissions + denied: 'Failed to authorize {{client}}: insufficient permissions' diff --git a/server/app/boot_auth.go b/server/app/boot_auth.go index be957f638..8e2371b76 100644 --- a/server/app/boot_auth.go +++ b/server/app/boot_auth.go @@ -39,6 +39,10 @@ func (app *CortezaApp) initAuth(ctx context.Context) (err error) { // set base path for links&routes in auth server authHandlers.BasePath = app.Opt.HTTPServer.BaseUrl + // set webapp base path in auth server + // @todo refactor, consider passing this into the functions that need it instead of setting it globally + authHandlers.WebappBasePath = app.Opt.HTTPServer.WebappBaseUrl + auth.DefaultSigner = auth.HmacSigner(app.Opt.Auth.Secret) if auth.HttpTokenVerifier, err = auth.TokenVerifierMiddlewareWithSecretSigner(app.Opt.Auth.Secret); err != nil { diff --git a/server/auth/assets/templates/inc_nav.html.tpl b/server/auth/assets/templates/inc_nav.html.tpl index 753460e0c..dee2086f2 100644 --- a/server/auth/assets/templates/inc_nav.html.tpl +++ b/server/auth/assets/templates/inc_nav.html.tpl @@ -12,18 +12,7 @@ {{ $activeNav := default "" .activeNav }} {{ if not .hideNav }} - {{ if and .user .client }} -
- - {{ tr "inc_nav.template.authorize-client" }} {{ .client.Name }} - - -
- {{ else if .user }} + {{ if .user }}