Skip to content

Commit

Permalink
fix: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ankarhem committed Oct 1, 2022
1 parent afeefec commit ef24e30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
21 changes: 12 additions & 9 deletions server/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,18 +476,21 @@ authRoutes.get('/oidc-callback', async (req, res, next) => {
// Fetch the token data
const callbackUrl = new URL(
'/api/v1/auth/oidc-callback',
`http://${req.headers.host}`
`${req.protocol}://${req.headers.host}`
);

const formData = new URLSearchParams();
formData.append('client_secret', oidcClientSecret);
formData.append('grant_type', 'authorization_code');
formData.append('redirect_uri', callbackUrl.toString());
formData.append('client_id', oidcClientId);
formData.append('code', code);
const response = await fetch(wellKnownInfo.token_endpoint, {
method: 'POST',
headers: new Headers([['Content-Type', 'application/json']]),
body: JSON.stringify({
client_cecret: oidcClientSecret,
grant_type: 'authorization_code',
redirect_uri: callbackUrl,
client_id: oidcClientId,
code,
}),
headers: new Headers([
['Content-Type', 'application/x-www-form-urlencoded'],
]),
body: formData,
});

// Check that the response is valid
Expand Down
4 changes: 2 additions & 2 deletions src/components/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = defineMessages({
signinheader: 'Sign in to continue',
signinwithplex: 'Use your Plex account',
signinwithoverseerr: 'Use your {applicationTitle} account',
signinwithoidc: 'Use your {oidcName} account',
signinwithoidcaccount: 'Use your {oidcName} account',
});

const Login = () => {
Expand Down Expand Up @@ -170,7 +170,7 @@ const Login = () => {
}`}
onClick={() => handleClick(2)}
>
{intl.formatMessage(messages.signinwithoidc, {
{intl.formatMessage(messages.signinwithoidcaccount, {
oidcName: settings.currentSettings.oidcName,
})}
</button>
Expand Down
5 changes: 2 additions & 3 deletions src/components/Settings/SettingsUsers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ const validationSchema = yup.object().shape({
test: (val) => {
return (
!!val &&
/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$/.test(
val
)
// Any HTTPS domain without query string
/^([a-zA-Z0-9-_]+\.)[^?]+$/i.test(val)
);
},
}),
Expand Down

0 comments on commit ef24e30

Please sign in to comment.