Skip to content

Commit

Permalink
10007: WIP save
Browse files Browse the repository at this point in the history
  • Loading branch information
pixiwyn committed Dec 8, 2023
1 parent 13de580 commit e89c543
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .cognito/db/local_2pHzece7.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"UserCreateDate": "2023-01-24T23:54:42.392Z",
"UserLastModifiedDate": "2023-02-21T18:41:41.466Z",
"RefreshTokens": [
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2duaXRvOnVzZXJuYW1lIjoiYWRtaW5AZXhhbXBsZS5jb20iLCJlbWFpbCI6ImFkbWluQGV4YW1wbGUuY29tIiwiaWF0IjoxNjc0NjA3NjUxLCJqdGkiOiI2YTFlNDJjMy03YjQ1LTQ2YzQtYThjNy1mNmQzYzc0ZjJiZGYiLCJleHAiOjE2NzUyMTI0NTEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6OTIyOS9sb2NhbF8ycEh6ZWNlNyJ9.BzhL5QDiMCwQNnrFCxcOses-vXAmZ_OsHaGTiI-zlcKRue4Qrqe3nC4HeCjqMEAe-VYjiU3rfw5yColhATG0ng41G2blGvmhMFqsqfQDV0XbISJFaE25OwmVzUegnTVXBMBu5H7UKZSHuivmbznh_Zb6dcZ1Rt3OEZuQOxjP9B0qDRj6M0T3wLfNcIWOjQCZWKM4ZgGmQUiwWOsiDkJWgp1LmAOmukie_SdDyLO6xUbJnrKBFYzGJaEECgkAevBI9kFgZ9eN4E9ineZN8S8U71ClTpyOQ4bZ5PeQdeKmDYlyB0truKEv-sh-WwJtUYvvXMqLns6nSXuw_Oq3Mb3vmg"
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2duaXRvOnVzZXJuYW1lIjoiYWRtaW5AZXhhbXBsZS5jb20iLCJlbWFpbCI6ImFkbWluQGV4YW1wbGUuY29tIiwiaWF0IjoxNjc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IoYu9vBaiHzeFolhv-CNF1ZBLQx3l1a7ul_VAoBn5_637GjB75LDscRsXET6Uibc99645RH3VY05A"
]
},
"[email protected]": {
Expand Down
3 changes: 3 additions & 0 deletions web-client/src/applicationContextPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ const applicationContextPublic = {
return process.env.API_URL || 'http://localhost:5000';
},
getCaseTitle: Case.getCaseTitle,
getCognitoClientId: () => {
return process.env.COGNITO_CLIENT_ID || 'bvjrggnd3co403c0aahscinne';
},
getCognitoRequestPasswordResetUrl,
getConstants: () => frozenConstants,
getCurrentUser: () => ({}),
Expand Down
31 changes: 29 additions & 2 deletions web-client/src/presenter/sequences/Login/submitLoginSequence.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
import { CognitoIdentityServiceProvider } from 'aws-sdk';
import { state } from '@web-client/presenter/app-public.cerebral';

export const submitLoginSequence = [
({ get }) => {
async ({ applicationContext, get }: ActionProps) => {
const { email, password } = get(state.form);
console.log('in submitLoginSequence');
console.log(get(state.form));
console.log(email, password);

// Call Cognito
const cognito = new CognitoIdentityServiceProvider({
endpoint: 'http://localhost:9229/',
httpOptions: {
connectTimeout: 3000,
timeout: 5000,
},
maxRetries: 3,
region: 'local',
});

const result = await cognito
.initiateAuth({
AuthFlow: 'USER_PASSWORD_AUTH',
AuthParameters: {
PASSWORD: password,
USERNAME: email,
},
ClientId: applicationContext.getCognitoClientId(),
})
.promise();

console.log('result from cognito: ', result);
// Call some endpoint to get token & refresh token
},
] as unknown as (props) => void;
5 changes: 4 additions & 1 deletion web-client/src/views/Public/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export const Login = connect(
</button>
<Button
className="usa-button margin-top-3"
onClick={() => submitLoginSequence()}
onClick={e => {
e.preventDefault();
submitLoginSequence();
}}
>
Log in
</Button>
Expand Down

0 comments on commit e89c543

Please sign in to comment.