Skip to content

Commit b63c0a1

Browse files
committed
Add the github Oauth option to the dev login page
Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
1 parent 18eb91b commit b63c0a1

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

src/app/login/page.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
import React, { useState, useEffect } from 'react';
55
import { signIn } from 'next-auth/react';
6-
import GithubLogin from './githublogin';
76
import { Grid, GridItem } from '@patternfly/react-core/dist/dynamic/layouts/Grid';
87
import { Text, TextContent } from '@patternfly/react-core/dist/dynamic/components/Text';
98
import { Form, FormGroup } from '@patternfly/react-core/dist/dynamic/components/Form';
109
import { TextInput } from '@patternfly/react-core/dist/dynamic/components/TextInput';
1110
import { Button } from '@patternfly/react-core/dist/dynamic/components/Button';
1211
import { HelperText, HelperTextItem } from '@patternfly/react-core/dist/dynamic/components/HelperText';
12+
import GithubIcon from '@patternfly/react-icons/dist/dynamic/icons/github-icon';
1313
import './githublogin.css';
1414

1515
const Login: React.FunctionComponent = () => {
@@ -49,6 +49,10 @@ const Login: React.FunctionComponent = () => {
4949
setPassword(value);
5050
};
5151

52+
const handleGitHubLogin = () => {
53+
signIn('github', { callbackUrl: '/' });
54+
};
55+
5256
const loginForm = (
5357
<Form onSubmit={handleLogin}>
5458
<FormGroup label="Username" fieldId="username" className="login-label">
@@ -85,12 +89,24 @@ const Login: React.FunctionComponent = () => {
8589
<Grid hasGutter span={12}>
8690
<GridItem span={6} className="login-container">
8791
<TextContent>
88-
<Text className="sign-in-text">Login locally with admin username and password</Text>
92+
<Text className="sign-in-text">Login locally with a username and password or via Github OAuth</Text>
8993
</TextContent>
9094
<TextContent>
9195
<Text className="description-text">Join the novel, community-based movement to create truly open-source LLMs</Text>
9296
</TextContent>
93-
<div className="login-container">{loginForm}</div>
97+
<div className="login-container">
98+
<Button
99+
variant="primary"
100+
icon={<GithubIcon />}
101+
iconPosition="left"
102+
size="lg"
103+
style={{ backgroundColor: 'black', marginBottom: '1rem' }}
104+
onClick={handleGitHubLogin}
105+
>
106+
Sign in with GitHub
107+
</Button>
108+
{loginForm}
109+
</div>
94110
<TextContent>
95111
<Text className="urls-text">
96112
<a href="https://github.com/instructlab/" style={{ color: 'white', textDecoration: 'underline' }} target="_blank">
@@ -128,7 +144,13 @@ const Login: React.FunctionComponent = () => {
128144
</div>
129145
);
130146

131-
return isProd ? <GithubLogin /> : devModeContent;
147+
return isProd ? (
148+
<Button variant="primary" icon={<GithubIcon />} iconPosition="left" onClick={handleGitHubLogin}>
149+
Sign in with GitHub
150+
</Button>
151+
) : (
152+
devModeContent
153+
);
132154
};
133155

134156
export default Login;

src/components/Contribute/Knowledge/knowledge.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
border-color: #45a049;
2424
}
2525

26-
.spinner-container{
26+
.spinner-container {
2727
display: flex;
2828
justify-content: center;
2929
align-items: center;

0 commit comments

Comments
 (0)