-
Notifications
You must be signed in to change notification settings - Fork 307
feat: oauth landing page [SQSERVICES-1775] #14793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 25 commits
cd1701a
da4d9c7
7b3e1c2
6c667af
02e54a2
419021c
6baeb80
d4a84ac
eed53b8
a492a6f
f9579ae
728ed3e
5176729
b245105
0276e94
08c7899
0f4fc94
de0172c
67cf9f1
e4067de
3f0bd47
b9de86c
fe862aa
7773e81
9cbcf6d
5291e2a
cd585b0
cdabad4
a8b48c4
b8a7c5b
dee8034
550279e
20c19a8
0b1d886
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,9 @@ import type {DomainData} from '@wireapp/api-client/lib/account/DomainData'; | |
| import type {LoginData, RegisterData, SendLoginCode} from '@wireapp/api-client/lib/auth/'; | ||
| import {VerificationActionType} from '@wireapp/api-client/lib/auth/VerificationActionType'; | ||
| import {ClientType} from '@wireapp/api-client/lib/client/'; | ||
| import {OAuthBody} from '@wireapp/api-client/lib/oauth/OAuthBody'; | ||
| import {OAuthClient} from '@wireapp/api-client/lib/oauth/OAuthClient'; | ||
| import type {TeamData} from '@wireapp/api-client/lib/team/'; | ||
| import {LowDiskSpaceError} from '@wireapp/store-engine/lib/engine/error'; | ||
| import {StatusCodes as HTTP_STATUS, StatusCodes} from 'http-status-codes'; | ||
|
|
||
|
|
@@ -145,6 +148,20 @@ export class AuthAction { | |
| }; | ||
| }; | ||
|
|
||
| doPostOAuthCode = (oauthBody: OAuthBody): ThunkAction<Promise<string>> => { | ||
| return async (dispatch, getState, {apiClient}) => { | ||
| dispatch(AuthActionCreator.startSendOAuthCode()); | ||
| try { | ||
| const url = await apiClient.api.oauth.postOAuthCode(oauthBody); | ||
| dispatch(AuthActionCreator.successfulSendOAuthCode()); | ||
| return url; | ||
| } catch (error) { | ||
| dispatch(AuthActionCreator.failedSendOAuthCode(error)); | ||
| throw error; | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| doSendTwoFactorLoginCode = (email: string): ThunkAction => { | ||
| return async (dispatch, getState, {apiClient}) => { | ||
| dispatch(AuthActionCreator.startSendTwoFactorCode()); | ||
|
|
@@ -185,6 +202,34 @@ export class AuthAction { | |
| }; | ||
| }; | ||
|
|
||
| doGetTeamData = (teamId?: string): ThunkAction<Promise<TeamData>> => { | ||
| return async (dispatch, getState, {apiClient}) => { | ||
| dispatch(AuthActionCreator.startFetchTeam()); | ||
| try { | ||
| const teamData = await apiClient.api.teams.team.getTeam(teamId ?? getState().selfState.self.team ?? ''); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty string as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea |
||
| dispatch(AuthActionCreator.successfulFetchTeam(teamData)); | ||
| return teamData; | ||
| } catch (error) { | ||
| dispatch(AuthActionCreator.failedFetchTeam(error)); | ||
| throw error; | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| doGetOAuthApplication = (applicationId: string): ThunkAction<Promise<OAuthClient>> => { | ||
| return async (dispatch, getState, {apiClient}) => { | ||
| dispatch(AuthActionCreator.startFetchOAuth()); | ||
| try { | ||
| const application = await apiClient.api.oauth.getClient(applicationId); | ||
| dispatch(AuthActionCreator.successfulFetchOAuth(application)); | ||
| return application; | ||
| } catch (error) { | ||
| dispatch(AuthActionCreator.failedFetchOAuth(error)); | ||
| throw error; | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| validateSSOCode = (code: string): ThunkAction => { | ||
| return async (dispatch, getState, {apiClient}) => { | ||
| const mapError = (error: any) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,7 +78,7 @@ export class ClientAction { | |
| }; | ||
| }; | ||
|
|
||
| generateClientPayload = (clientType: ClientType): ClientInfo | undefined => { | ||
| private generateClientPayload = (clientType: ClientType): ClientInfo | undefined => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 🙏 |
||
| if (clientType === ClientType.NONE) { | ||
| return undefined; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use
jestinstead ofjasmineif possible:jest.fn().mockReturnValue({})There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense