Skip to content

Commit fb705ea

Browse files
committed
fix: final review comments
1 parent 673f556 commit fb705ea

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

frontend/src/pages/authorize-page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ export const AuthorizePage = () => {
109109
},
110110
});
111111

112-
if (!isLoggedIn) {
113-
return <Navigate to={`/login?${compiledOIDCParams}`} replace />;
114-
}
115-
116112
if (missingParams.length > 0) {
117113
return (
118114
<Navigate
@@ -122,6 +118,10 @@ export const AuthorizePage = () => {
122118
);
123119
}
124120

121+
if (!isLoggedIn) {
122+
return <Navigate to={`/login?${compiledOIDCParams}`} replace />;
123+
}
124+
125125
if (getClientInfo.isLoading) {
126126
return (
127127
<Card className="min-w-xs sm:min-w-sm">

frontend/src/pages/login-page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export const LoginPage = () => {
9090
mutationKey: ["login"],
9191
onSuccess: (data) => {
9292
if (data.data.totpPending) {
93-
window.location.replace(`/totp?${compiledOIDCParams}`);
93+
window.location.replace(
94+
`/totp?redirect_uri=${encodeURIComponent(props.redirect_uri)}`,
95+
);
9496
return;
9597
}
9698

internal/controller/oidc_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ func (controller *OIDCController) Token(c *gin.Context) {
233233
entry, err := controller.oidc.GetCodeEntry(c, controller.oidc.Hash(req.Code))
234234
if err != nil {
235235
if errors.Is(err, service.ErrCodeNotFound) {
236-
tlog.App.Warn().Str("code", req.Code).Msg("Code not found")
236+
tlog.App.Warn().Msg("Code not found")
237237
c.JSON(400, gin.H{
238238
"error": "invalid_grant",
239239
})
240240
return
241241
}
242242
if errors.Is(err, service.ErrCodeExpired) {
243-
tlog.App.Warn().Str("code", req.Code).Msg("Code expired")
243+
tlog.App.Warn().Msg("Code expired")
244244
c.JSON(400, gin.H{
245245
"error": "invalid_grant",
246246
})

0 commit comments

Comments
 (0)