From: Peter Amstutz Date: Thu, 7 Nov 2019 16:33:33 +0000 (-0500) Subject: 15803: If user is inactive, attempt to self-activate. X-Git-Tag: 2.0.0~26^2~12 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/39a2bbbbe3099f039acf73358753f91c0dc39677 15803: If user is inactive, attempt to self-activate. This mimics the behavior of workbench 1, however we don't support displaying / signing user agreements. --- diff --git a/src/services/user-service/user-service.ts b/src/services/user-service/user-service.ts index bcf81d55..ddb9a364 100644 --- a/src/services/user-service/user-service.ts +++ b/src/services/user-service/user-service.ts @@ -12,6 +12,14 @@ export class UserService extends CommonResourceService { super(serverApi, "users", actions); } + activate(uuid: string) { + return CommonResourceService.defaultResponse( + this.serverApi + .post(this.resourceType + `${uuid}/activate`), + this.actions + ); + } + unsetup(uuid: string) { return CommonResourceService.defaultResponse( this.serverApi diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index 9f18b5b0..cadf3c6e 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -81,6 +81,11 @@ const init = (config: Config) => (dispatch: Dispatch, getState: () => RootState, dispatch(initSessions(services.authService, config, user)); dispatch(getUserDetails()).then((user: User) => { dispatch(authActions.INIT({ user, token })); + if (!user.isActive) { + services.userService.activate(user.uuid).then((user: User) => { + dispatch(authActions.INIT({ user, token })); + }); + } }).catch((err: AxiosError) => { if (err.response) { // Bad token