Skip to content

Commit a627f41

Browse files
authored
add oauth page (#217)
* add oauth page * change page comment
1 parent d4bdfe8 commit a627f41

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pub",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"private": true,
55
"scripts": {
66
"build": "gatsby build --prefix-paths",

src/components/shared/form/reset-password.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ interface ResetPasswordFormProps {
3636
}
3737

3838
export const ResetPasswordForm: FC<ResetPasswordFormProps> = (props) => {
39-
const [newPassword, setNewPassword] = useState<string>('');
40-
const [confirmNewPassword, setConfirmNewPassword] = useState<string>('');
39+
const [newPassword, setNewPassword] = useState('');
40+
const [confirmNewPassword, setConfirmNewPassword] = useState('');
4141
const [formValid, setFormValid] = useState(true);
4242
const [formMessage, setFormMessage] = useState('');
4343

src/pages/magic-login.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { AuthContext } from '@contexts';
1818
const MagicLoginPage: FC = () => {
1919
const location = useLocation();
2020
const authContext = useContext(AuthContext);
21-
const [message, setMessage] = useState<string>('Logging in...');
21+
const [message, setMessage] = useState('Logging in...');
2222
const siteMetadata = useSiteMetadata();
2323

2424
const handleLogin = (token: string | null) => {
@@ -50,7 +50,7 @@ const MagicLoginPage: FC = () => {
5050
return (
5151
<Layout>
5252
<Seo
53-
title={`${siteMetadata.title} - Magic Login`}
53+
title={`Magic Login`}
5454
description={`Magic login page for ${siteMetadata.title} website`}
5555
urlSlug="magin-login/"
5656
/>

src/pages/oauth.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React, { FC, useState, useEffect } from 'react';
2+
import { useLocation } from '@reach/router';
3+
4+
import {
5+
Container,
6+
Layout,
7+
PageTitle,
8+
PageBody,
9+
Seo,
10+
} from '@components/shared';
11+
import { useSiteMetadata } from '@hooks';
12+
13+
/* Page supports oauth authorization flow */
14+
const OauthPage: FC = () => {
15+
const location = useLocation();
16+
const siteMetadata = useSiteMetadata();
17+
const [appName, setAppName] = useState('App');
18+
19+
useEffect(() => {
20+
const app = new URLSearchParams(location.search).get('app');
21+
if (app === null) {
22+
return;
23+
}
24+
setAppName(app);
25+
}, [location.search]);
26+
27+
return (
28+
<Layout>
29+
<Seo
30+
title={`Oauth`}
31+
description={`Oauth page for ${siteMetadata.title} website`}
32+
urlSlug="oauth/"
33+
/>
34+
<Container>
35+
<PageTitle>Successfully Authorized {appName}</PageTitle>
36+
<PageBody>
37+
<p>
38+
You successfully authorized {appName}. You can close this window.
39+
</p>
40+
</PageBody>
41+
</Container>
42+
</Layout>
43+
);
44+
};
45+
46+
export default OauthPage;

0 commit comments

Comments
 (0)