Skip to content

Commit d3d04a0

Browse files
committed
feat(auth): add OIDC login button to login page
1 parent 3c3468e commit d3d04a0

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/ui/views/Login/Login.jsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export default function UserProfile() {
3333
);
3434
}
3535

36+
function handleOIDCLogin() {
37+
window.location.href = `${import.meta.env.VITE_API_URI}/api/auth/oidc`;
38+
}
39+
3640
function handleSubmit(event) {
3741
setIsLoading(true);
3842
axios
@@ -104,7 +108,7 @@ export default function UserProfile() {
104108
width={'150px'}
105109
src={logo}
106110
alt='logo'
107-
data-test ="git-proxy-logo"
111+
data-test='git-proxy-logo'
108112
/>
109113
</div>
110114
</CardHeader>
@@ -119,7 +123,7 @@ export default function UserProfile() {
119123
value={username}
120124
onChange={(e) => setUsername(e.target.value)}
121125
autoFocus={true}
122-
data-test ='username'
126+
data-test='username'
123127
/>
124128
</FormControl>
125129
</GridItem>
@@ -133,17 +137,28 @@ export default function UserProfile() {
133137
type='password'
134138
value={password}
135139
onChange={(e) => setPassword(e.target.value)}
136-
data-test ='password'
140+
data-test='password'
137141
/>
138142
</FormControl>
139143
</GridItem>
140144
</GridContainer>
141145
</CardBody>
142146
<CardFooter>
143147
{!isLoading ? (
144-
<Button color='success' block disabled={!validateForm()} type='submit' data-test="login">
145-
Login
146-
</Button>
148+
<>
149+
<Button
150+
color='success'
151+
block
152+
disabled={!validateForm()}
153+
type='submit'
154+
data-test='login'
155+
>
156+
Login
157+
</Button>
158+
<Button color='warning' block onClick={handleOIDCLogin} data-test='oidc-login'>
159+
Login with OIDC
160+
</Button>
161+
</>
147162
) : (
148163
<div style={{ textAlign: 'center', width: '100%', opacity: 0.5, color: 'green' }}>
149164
<CircularProgress color='inherit' />

0 commit comments

Comments
 (0)