Skip to content

Commit 2ac17c6

Browse files
authored
refactor: temporarily disable oauth login method (#952)
* refactor: temporarily disable oauth login until we re-implement * refactor: temporarily disable oauth login until we re-implement * add fixme and reference to open gh issues * dynamically insert AUTH_SCOPE count
1 parent 973aaed commit 2ac17c6

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

src/routes/Login.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const { ipcRenderer } = require('electron');
22

3-
import React, { useCallback, useContext, useEffect } from 'react';
3+
import React, { useContext, useEffect } from 'react';
44
import { useNavigate } from 'react-router-dom';
55

66
import { AppContext } from '../context/App';
77
import { Logo } from '../components/Logo';
88

99
export const LoginRoute: React.FC = () => {
1010
const navigate = useNavigate();
11-
const { isLoggedIn, login } = useContext(AppContext);
11+
const { isLoggedIn } = useContext(AppContext);
1212

1313
useEffect(() => {
1414
if (isLoggedIn) {
@@ -17,16 +17,17 @@ export const LoginRoute: React.FC = () => {
1717
}
1818
}, [isLoggedIn]);
1919

20-
const loginUser = useCallback(async () => {
20+
// FIXME: Temporarily disable Login with GitHub (OAuth) as it's currently broken and requires a rewrite - see #485 #561 #747
21+
/* const loginUser = useCallback(async () => {
2122
try {
2223
await login();
2324
} catch (err) {
2425
// Skip
2526
}
26-
}, []);
27+
}, []); */
2728

2829
const loginButtonClass =
29-
'w-48 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none';
30+
'w-50 px-2 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none';
3031

3132
return (
3233
<div className="flex flex-1 flex-col justify-center items-center p-4 bg-white dark:bg-gray-dark dark:text-white">
@@ -36,13 +37,26 @@ export const LoginRoute: React.FC = () => {
3637
GitHub Notifications <br /> on your menu bar.
3738
</div>
3839

40+
{
41+
// FIXME: Temporarily disable Login with GitHub (OAuth) as it's currently broken and requires a rewrite - see #485 #561 #747
42+
/*
3943
<button
4044
className={loginButtonClass}
4145
title="Login with GitHub"
4246
aria-label="Login with GitHub"
4347
onClick={loginUser}
4448
>
4549
Login to GitHub
50+
</button> */
51+
}
52+
53+
<button
54+
className={loginButtonClass}
55+
title="Login with Personal Token"
56+
aria-label="Login with Personal Token"
57+
onClick={() => navigate('/login-token')}
58+
>
59+
Login with Personal Access Token
4660
</button>
4761

4862
<button
@@ -53,15 +67,6 @@ export const LoginRoute: React.FC = () => {
5367
>
5468
Login to GitHub Enterprise
5569
</button>
56-
57-
<button
58-
className="bg-none hover:text-gray-800 dark:text-gray-100 dark:hover:text-gray-300 mt-4 focus:outline-none"
59-
title="Login with Personal Token"
60-
aria-label="Login with Personal Token"
61-
onClick={() => navigate('/login-token')}
62-
>
63-
<small>or login with a personal token</small>
64-
</button>
6570
</div>
6671
);
6772
};

src/routes/LoginWithToken.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export const LoginWithToken: React.FC = () => {
7171
>
7272
personal access tokens
7373
</a>{' '}
74-
and create one with the{' '}
74+
and create one with the {Constants.AUTH_SCOPE.length} scopes{' '}
7575
<span className="underline font-extrabold text-yellow-500">
7676
{Constants.AUTH_SCOPE.join(', ')}{' '}
7777
</span>
78-
scopes.
78+
.
7979
</>
8080
}
8181
/>
@@ -130,7 +130,9 @@ export const LoginWithToken: React.FC = () => {
130130
/>
131131
</button>
132132

133-
<h3 className="text-lg font-semibold">Login with an access token</h3>
133+
<h3 className="text-lg font-semibold">
134+
Login with personal access token
135+
</h3>
134136
</div>
135137

136138
<div className="flex-1 px-8">

src/routes/__snapshots__/Login.test.tsx.snap

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,20 @@ exports[`routes/Login.tsx should render itself & its children 1`] = `
5656
on your menu bar.
5757
</div>
5858
<button
59-
aria-label="Login with GitHub"
60-
className="w-48 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none"
59+
aria-label="Login with Personal Token"
60+
className="w-50 px-2 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none"
6161
onClick={[Function]}
62-
title="Login with GitHub"
62+
title="Login with Personal Token"
6363
>
64-
Login to GitHub
64+
Login with Personal Access Token
6565
</button>
6666
<button
6767
aria-label="Login with GitHub Enterprise"
68-
className="w-48 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none"
68+
className="w-50 px-2 py-2 my-2 bg-gray-300 font-semibold rounded text-xs text-center dark:text-black hover:bg-gray-500 hover:text-white focus:outline-none"
6969
onClick={[Function]}
7070
title="Login with GitHub Enterprise"
7171
>
7272
Login to GitHub Enterprise
7373
</button>
74-
<button
75-
aria-label="Login with Personal Token"
76-
className="bg-none hover:text-gray-800 dark:text-gray-100 dark:hover:text-gray-300 mt-4 focus:outline-none"
77-
onClick={[Function]}
78-
title="Login with Personal Token"
79-
>
80-
<small>
81-
or login with a personal token
82-
</small>
83-
</button>
8474
</div>
8575
`;

src/routes/__snapshots__/LoginWithToken.test.tsx.snap

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports[`routes/LoginWithToken.tsx renders correctly 1`] = `
3838
<h3
3939
className="text-lg font-semibold"
4040
>
41-
Login with an access token
41+
Login with personal access token
4242
</h3>
4343
</div>
4444
<div
@@ -80,15 +80,17 @@ exports[`routes/LoginWithToken.tsx renders correctly 1`] = `
8080
personal access tokens
8181
</a>
8282
83-
and create one with the
83+
and create one with the
84+
3
85+
scopes
8486
8587
<span
8688
className="underline font-extrabold text-yellow-500"
8789
>
8890
read:user, notifications, repo
8991
9092
</span>
91-
scopes.
93+
.
9294
</div>
9395
</div>
9496
<div

0 commit comments

Comments
 (0)