Skip to content
This repository was archived by the owner on Aug 19, 2023. It is now read-only.

Commit 02fbf09

Browse files
authored
added login options for IDIR and BCeID (#15)
1 parent a848fe0 commit 02fbf09

File tree

5 files changed

+17
-79
lines changed

5 files changed

+17
-79
lines changed

frontend/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Help from "./screens/Help";
1212
import Reports from './screens/Reports';
1313
import TopLayout from './layouts/TopLayout';
1414
import SideLayout from './layouts/SideLayout';
15-
import Login from './screens/Login';
1615
import Dashboard from './screens/Dashboard';
1716
import PostLoginRoute from './routes/PostLoginRoute';
1817
import ProtectedRoute from './routes/ProtectedRoute';
@@ -29,7 +28,6 @@ const App: React.FC = () => {
2928
<SideLayout pageContent={<Dashboard/>} />
3029
</PostLoginRoute>
3130
} />
32-
<Route path="/login" element={<TopLayout pageContent={<Login/>} />} />
3331
<Route path="/reports" element={
3432
<ProtectedRoute signed={true}>
3533
<SideLayout pageContent={<Reports/>} />

frontend/src/screens/Landing/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const Landing: React.FC = () => {
6666
<div className="row gy-3">
6767
<div className="col-xl-5 col-lg-6">
6868
<Button
69-
onClick={signIn}
69+
onClick={()=>signIn('idir')}
7070
renderIcon={Login}
7171
data-testid="landing-button__idir"
7272
className="btn-landing"
@@ -77,7 +77,7 @@ const Landing: React.FC = () => {
7777
<div className="col-xl-5 col-lg-6 ">
7878
<Button
7979
kind="tertiary"
80-
onClick={() => { console.log("Hi BCEid was clicked") }}
80+
onClick={() => {signIn('bceid')}}
8181
renderIcon={Login}
8282
data-testid="landing-button__bceid"
8383
className="btn-landing"

frontend/src/screens/Login/Landing.scss

Lines changed: 0 additions & 4 deletions
This file was deleted.

frontend/src/screens/Login/index.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

frontend/src/services/AuthService.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@ export interface FamLoginUser {
1010
authToken?: CognitoUserSession;
1111
}
1212

13-
export const signIn = async () => {
14-
Auth.federatedSignIn();
13+
export const signIn = async (provider:String) => {
14+
if(provider.localeCompare('idir') === 0){
15+
Auth.federatedSignIn({
16+
customProvider:'DEV-IDIR'
17+
});
18+
}
19+
else if(provider.localeCompare('bceid') === 0){
20+
Auth.federatedSignIn({
21+
customProvider:'DEV-BCEIDBUSINESS'
22+
});
23+
}
24+
//else if invalid option passed logout the user
25+
else{
26+
logout();
27+
}
1528
};
1629

1730
export const isLoggedIn = () =>{

0 commit comments

Comments
 (0)