mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 09:33:11 +00:00
Redirect user to /me/settings on cancelled OAuth flow
This commit is contained in:
parent
7a09a47de2
commit
217430e56b
1 changed files with 6 additions and 0 deletions
6
oauth.go
6
oauth.go
|
@ -326,6 +326,12 @@ func (h oauthHandler) viewOauthCallback(app *App, w http.ResponseWriter, r *http
|
|||
tokenResponse, err := h.oauthClient.exchangeOauthCode(ctx, code)
|
||||
if err != nil {
|
||||
log.Error("Unable to exchangeOauthCode: %s", err)
|
||||
// TODO: show user friendly message if needed
|
||||
// TODO: show NO message for cases like user pressing "Cancel" on authorize step
|
||||
addSessionFlash(app, w, r, err.Error(), nil)
|
||||
if attachUserID > 0 {
|
||||
return impart.HTTPError{http.StatusFound, "/me/settings"}
|
||||
}
|
||||
return impart.HTTPError{http.StatusInternalServerError, err.Error()}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue