test
Seto Elkahfi committed
Nov 24, 2024 at 22:06 UTC
f92386127333ad8db1c294acefa51c474cea4251
3 files changed
+62
-62
pages/login.tsx
+1
-4
@@ -19,9 +19,6 @@ export default function Login(props) {
19
const error = JSON.parse(props.error)
20
errorMessage = error.message
21
}
22
-
23
- const styleGithub = { "--color": '#e8eaea' };
24
-
22
return (
23
<>
24
<SharedHead
@@ -31,7 +28,7 @@ export default function Login(props) {
28
<main className={sharedStyles.main}>
29
<SharedTopBar />
30
<div className={inter.className}>
34
- <a className={loginStyles.button} href="https://github.com/login/oauth/authorize?client_id=053e152f1b78ecee552b&redirect_uri=http://localhost:3000/authorize" style={styleGithub}>
31
+ <a className={loginStyles.button} href="https://github.com/login/oauth/authorize?client_id=053e152f1b78ecee552b&redirect_uri=http://localhost:3000/authorize">
32
<span></span>
33
<span></span>
34
<span></span>
pages/v1/users/confirmation.ts
deleted
-58
@@ -1,58 +0,0 @@
1
-import axios from "../../../lib/axios"
2
-import SharedHead from "../../shared/head"
3
-import sharedStyles from '@/styles/Shared.module.css'
4
-import SharedTopBar from "@/pages/shared/topbar"
5
-import { Inter } from "next/font/google"
6
-import SharedFooter from "@/pages/shared/footer"
7
-import { BsMailbox2 } from "react-icons/bs"
8
-import Link from "next/link"
9
-const inter = Inter({ subsets: ['latin'] })
10
-
11
-export const getServerSideProps = async ({ query }) => {
12
- const confirmationToken = query.confirmation_token
13
- try {
14
- const res = await axios.get(`users/confirmation?confirmation_token=${confirmationToken}`)
15
- console.log(res)
16
- const user = res.data
17
- return {
18
- props: {
19
- user
20
- }
21
- }
22
- } catch (error) {
23
- console.log('Error confirmation', error.response.data)
24
- return {
25
- redirect: {
26
- destination: `/login?error=${JSON.stringify(error.response.data)}`,
27
- permanent: false,
28
- }
29
- }
30
- }
31
-}
32
-
33
-export default function Confirmation({ user }) {
34
-
35
- return (
36
- <>
37
- <SharedHead
38
- title="Your email has been verified."
39
- description="Your email has been verified. Now you can login with your GitHub account."
40
- />
41
- <main className={sharedStyles.main}>
42
- <SharedTopBar />
43
- <h1 className={inter.className}>Confirmation</h1>
44
- <div className={inter.className}>
45
- <div className={sharedStyles.center}>
46
- <BsMailbox2 size="5em" />
47
- </div>
48
- <div className={sharedStyles.center}>
49
- <p className={inter.className}>
50
- Your email has been verified. Now you can login with your GitHub account.
51
- You will be redirect to the login page. Or click the link on the top left corner.</p>
52
- </div>
53
- </div>
54
- <SharedFooter />
55
- </main>
56
- </>
57
- )
58
-}
\ No newline at end of file
pages/v1/users/confirmation.tsx
new
+61
@@ -0,0 +1,61 @@
1
+import axios from "../../../lib/axios";
2
+import SharedHead from "../../shared/head";
3
+import sharedStyles from "@/styles/Shared.module.css";
4
+import SharedTopBar from "@/pages/shared/topbar";
5
+import { Inter } from "next/font/google";
6
+import SharedFooter from "@/pages/shared/footer";
7
+import { BsMailbox2 } from "react-icons/bs";
8
+import Link from "next/link";
9
+const inter = Inter({ subsets: ["latin"] });
10
+
11
+export const getServerSideProps = async ({ query }) => {
12
+ const confirmationToken = query.confirmation_token;
13
+ try {
14
+ const res = await axios.get(
15
+ `users/confirmation?confirmation_token=${confirmationToken}`
16
+ );
17
+ console.log(res);
18
+ const user = res.data;
19
+ return {
20
+ props: {
21
+ user,
22
+ },
23
+ };
24
+ } catch (error) {
25
+ console.log("Error confirmation", error.response.data);
26
+ return {
27
+ redirect: {
28
+ destination: `/login?error=${JSON.stringify(error.response.data)}`,
29
+ permanent: false,
30
+ },
31
+ };
32
+ }
33
+};
34
+
35
+export default function Confirmation({ user }) {
36
+ return (
37
+ <>
38
+ <SharedHead
39
+ title="Your email has been verified."
40
+ description="Your email has been verified. Now you can login with your GitHub account."
41
+ />
42
+ <main className={sharedStyles.main}>
43
+ <SharedTopBar />
44
+ <h1 className={inter.className}>Confirmation</h1>
45
+ <div className={inter.className}>
46
+ <div className={sharedStyles.center}>
47
+ <BsMailbox2 size="5em" />
48
+ </div>
49
+ <div className={sharedStyles.center}>
50
+ <p className={inter.className}>
51
+ Your email has been verified. Now you can login with your GitHub
52
+ account. You will be redirect to the login page. Or click the link
53
+ on the top left corner.
54
+ </p>
55
+ </div>
56
+ </div>
57
+ <SharedFooter />
58
+ </main>
59
+ </>
60
+ );
61
+}