@webiny/cognito 0.0.0-unstable.0d717d18dd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cognito.d.ts +55 -0
- package/Cognito.js +102 -0
- package/Cognito.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/admin/Cognito.d.ts +8 -0
- package/admin/Cognito.js +50 -0
- package/admin/Cognito.js.map +1 -0
- package/admin/CognitoLogin.d.ts +7 -0
- package/admin/CognitoLogin.js +13 -0
- package/admin/CognitoLogin.js.map +1 -0
- package/admin/DefaultCognitoSignInConfig.d.ts +23 -0
- package/admin/DefaultCognitoSignInConfig.js +51 -0
- package/admin/DefaultCognitoSignInConfig.js.map +1 -0
- package/admin/Extension.d.ts +2 -0
- package/admin/Extension.js +45 -0
- package/admin/Extension.js.map +1 -0
- package/admin/SecurityPermission.d.ts +2 -0
- package/admin/SecurityPermission.js +15 -0
- package/admin/SecurityPermission.js.map +1 -0
- package/admin/SignInExtension.d.ts +2 -0
- package/admin/SignInExtension.js +9 -0
- package/admin/SignInExtension.js.map +1 -0
- package/admin/domain/permissionsSchema.d.ts +10 -0
- package/admin/domain/permissionsSchema.js +18 -0
- package/admin/domain/permissionsSchema.js.map +1 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.d.ts +11 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.js +44 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.js.map +1 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.js +19 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.d.ts +16 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.js +5 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js +5 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/index.d.ts +6 -0
- package/admin/features/account/getCurrentUser/abstractions/index.js +2 -0
- package/admin/features/account/getCurrentUser/feature.d.ts +3 -0
- package/admin/features/account/getCurrentUser/feature.js +19 -0
- package/admin/features/account/getCurrentUser/feature.js.map +1 -0
- package/admin/features/account/getCurrentUser/index.d.ts +1 -0
- package/admin/features/account/getCurrentUser/index.js +1 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.d.ts +11 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.js +48 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.js.map +1 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.js +19 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.d.ts +26 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js +5 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.d.ts +13 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js +5 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/index.d.ts +8 -0
- package/admin/features/account/updateCurrentUser/abstractions/index.js +2 -0
- package/admin/features/account/updateCurrentUser/feature.d.ts +3 -0
- package/admin/features/account/updateCurrentUser/feature.js +19 -0
- package/admin/features/account/updateCurrentUser/feature.js.map +1 -0
- package/admin/features/account/updateCurrentUser/index.d.ts +1 -0
- package/admin/features/account/updateCurrentUser/index.js +1 -0
- package/admin/features/permissions/abstractions.d.ts +17 -0
- package/admin/features/permissions/abstractions.js +6 -0
- package/admin/features/permissions/abstractions.js.map +1 -0
- package/admin/features/permissions/feature.d.ts +14 -0
- package/admin/features/permissions/feature.js +7 -0
- package/admin/features/permissions/feature.js.map +1 -0
- package/admin/features/users/createUser/CreateUserGateway.d.ts +11 -0
- package/admin/features/users/createUser/CreateUserGateway.js +49 -0
- package/admin/features/users/createUser/CreateUserGateway.js.map +1 -0
- package/admin/features/users/createUser/CreateUserUseCase.d.ts +10 -0
- package/admin/features/users/createUser/CreateUserUseCase.js +18 -0
- package/admin/features/users/createUser/CreateUserUseCase.js.map +1 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.d.ts +21 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.js +5 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.js.map +1 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.d.ts +14 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.js +5 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.js.map +1 -0
- package/admin/features/users/createUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/createUser/abstractions/index.js +2 -0
- package/admin/features/users/createUser/feature.d.ts +3 -0
- package/admin/features/users/createUser/feature.js +19 -0
- package/admin/features/users/createUser/feature.js.map +1 -0
- package/admin/features/users/createUser/index.d.ts +2 -0
- package/admin/features/users/createUser/index.js +2 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.d.ts +11 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.js +40 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.js.map +1 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.d.ts +10 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.js +18 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.d.ts +11 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.js +5 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.d.ts +11 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.js +5 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/deleteUser/abstractions/index.js +2 -0
- package/admin/features/users/deleteUser/feature.d.ts +3 -0
- package/admin/features/users/deleteUser/feature.js +19 -0
- package/admin/features/users/deleteUser/feature.js.map +1 -0
- package/admin/features/users/deleteUser/index.d.ts +2 -0
- package/admin/features/users/deleteUser/index.js +2 -0
- package/admin/features/users/getUser/GetUserGateway.d.ts +11 -0
- package/admin/features/users/getUser/GetUserGateway.js +57 -0
- package/admin/features/users/getUser/GetUserGateway.js.map +1 -0
- package/admin/features/users/getUser/GetUserUseCase.d.ts +10 -0
- package/admin/features/users/getUser/GetUserUseCase.js +18 -0
- package/admin/features/users/getUser/GetUserUseCase.js.map +1 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.d.ts +32 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.js +5 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.js.map +1 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.d.ts +14 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.js +5 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.js.map +1 -0
- package/admin/features/users/getUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/getUser/abstractions/index.js +2 -0
- package/admin/features/users/getUser/feature.d.ts +3 -0
- package/admin/features/users/getUser/feature.js +19 -0
- package/admin/features/users/getUser/feature.js.map +1 -0
- package/admin/features/users/getUser/index.d.ts +2 -0
- package/admin/features/users/getUser/index.js +2 -0
- package/admin/features/users/listUsers/ListUsersGateway.d.ts +11 -0
- package/admin/features/users/listUsers/ListUsersGateway.js +39 -0
- package/admin/features/users/listUsers/ListUsersGateway.js.map +1 -0
- package/admin/features/users/listUsers/ListUsersUseCase.d.ts +10 -0
- package/admin/features/users/listUsers/ListUsersUseCase.js +18 -0
- package/admin/features/users/listUsers/ListUsersUseCase.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.d.ts +17 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.js +5 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.d.ts +10 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.js +5 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/index.d.ts +2 -0
- package/admin/features/users/listUsers/abstractions/index.js +2 -0
- package/admin/features/users/listUsers/feature.d.ts +3 -0
- package/admin/features/users/listUsers/feature.js +19 -0
- package/admin/features/users/listUsers/feature.js.map +1 -0
- package/admin/features/users/listUsers/index.d.ts +2 -0
- package/admin/features/users/listUsers/index.js +2 -0
- package/admin/features/users/updateUser/UpdateUserGateway.d.ts +11 -0
- package/admin/features/users/updateUser/UpdateUserGateway.js +59 -0
- package/admin/features/users/updateUser/UpdateUserGateway.js.map +1 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.d.ts +10 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.js +18 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.d.ts +33 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.js +5 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.d.ts +15 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.js +5 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/updateUser/abstractions/index.js +2 -0
- package/admin/features/users/updateUser/feature.d.ts +3 -0
- package/admin/features/users/updateUser/feature.js +19 -0
- package/admin/features/users/updateUser/feature.js.map +1 -0
- package/admin/features/users/updateUser/index.d.ts +2 -0
- package/admin/features/users/updateUser/index.js +2 -0
- package/admin/federatedIdentityProviders.d.ts +9 -0
- package/admin/federatedIdentityProviders.js +10 -0
- package/admin/federatedIdentityProviders.js.map +1 -0
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.d.ts +10 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js +60 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -0
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +81 -0
- package/admin/presentation/Cognito/CognitoPresenter.js +386 -0
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.d.ts +31 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js +5 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js.map +1 -0
- package/admin/presentation/Cognito/abstractions.d.ts +91 -0
- package/admin/presentation/Cognito/abstractions.js +5 -0
- package/admin/presentation/Cognito/abstractions.js.map +1 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.d.ts +26 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js +45 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js.map +1 -0
- package/admin/presentation/Cognito/components/Divider.d.ts +20 -0
- package/admin/presentation/Cognito/components/Divider.js +16 -0
- package/admin/presentation/Cognito/components/Divider.js.map +1 -0
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +24 -0
- package/admin/presentation/Cognito/components/FederatedLogin.js +43 -0
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -0
- package/admin/presentation/Cognito/components/FederatedProviders.d.ts +44 -0
- package/admin/presentation/Cognito/components/FederatedProviders.js +11 -0
- package/admin/presentation/Cognito/components/FederatedProviders.js.map +1 -0
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +23 -0
- package/admin/presentation/Cognito/components/FooterSignIn.js +13 -0
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +27 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +40 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +26 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +42 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +26 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.js +52 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -0
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +26 -0
- package/admin/presentation/Cognito/components/SetNewPassword.js +79 -0
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -0
- package/admin/presentation/Cognito/components/SetupTotp.d.ts +25 -0
- package/admin/presentation/Cognito/components/SetupTotp.js +60 -0
- package/admin/presentation/Cognito/components/SetupTotp.js.map +1 -0
- package/admin/presentation/Cognito/components/SignIn.d.ts +26 -0
- package/admin/presentation/Cognito/components/SignIn.js +64 -0
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -0
- package/admin/presentation/Cognito/components/View.d.ts +98 -0
- package/admin/presentation/Cognito/components/View.js +48 -0
- package/admin/presentation/Cognito/components/View.js.map +1 -0
- package/admin/presentation/Cognito/components/index.d.ts +292 -0
- package/admin/presentation/Cognito/components/index.js +29 -0
- package/admin/presentation/Cognito/components/index.js.map +1 -0
- package/admin/presentation/Cognito/feature.d.ts +3 -0
- package/admin/presentation/Cognito/feature.js +17 -0
- package/admin/presentation/Cognito/feature.js.map +1 -0
- package/admin/presentation/Cognito/signInFeature.d.ts +1 -0
- package/admin/presentation/Cognito/signInFeature.js +11 -0
- package/admin/presentation/Cognito/signInFeature.js.map +1 -0
- package/admin/presentation/shared/createPasswordValidator.d.ts +8 -0
- package/admin/presentation/shared/createPasswordValidator.js +16 -0
- package/admin/presentation/shared/createPasswordValidator.js.map +1 -0
- package/admin/presentation/shared/usePasswordValidator.d.ts +1 -0
- package/admin/presentation/shared/usePasswordValidator.js +16 -0
- package/admin/presentation/shared/usePasswordValidator.js.map +1 -0
- package/admin/presentation/userMenu/AccountDetails.d.ts +6 -0
- package/admin/presentation/userMenu/AccountDetails.js +20 -0
- package/admin/presentation/userMenu/AccountDetails.js.map +1 -0
- package/admin/presentation/userMenu/useIsDefaultTenant.d.ts +1 -0
- package/admin/presentation/userMenu/useIsDefaultTenant.js +9 -0
- package/admin/presentation/userMenu/useIsDefaultTenant.js.map +1 -0
- package/admin/routes.d.ts +10 -0
- package/admin/routes.js +20 -0
- package/admin/routes.js.map +1 -0
- package/admin/ui/UserItem.d.ts +10 -0
- package/admin/ui/UserItem.js +0 -0
- package/admin/ui/components/AvatarImage/AvatarImage.d.ts +3 -0
- package/admin/ui/components/AvatarImage/AvatarImage.js +31 -0
- package/admin/ui/components/AvatarImage/AvatarImage.js.map +1 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.d.ts +10 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js +53 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js.map +1 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.d.ts +7 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js +28 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js.map +1 -0
- package/admin/ui/components/AvatarImage/index.d.ts +1 -0
- package/admin/ui/components/AvatarImage/index.js +1 -0
- package/admin/ui/views/Account/Account.d.ts +2 -0
- package/admin/ui/views/Account/Account.js +137 -0
- package/admin/ui/views/Account/Account.js.map +1 -0
- package/admin/ui/views/Account/index.d.ts +1 -0
- package/admin/ui/views/Account/index.js +1 -0
- package/admin/ui/views/Users/UsersDataList.d.ts +3 -0
- package/admin/ui/views/Users/UsersDataList.js +177 -0
- package/admin/ui/views/Users/UsersDataList.js.map +1 -0
- package/admin/ui/views/Users/UsersForm.d.ts +5 -0
- package/admin/ui/views/Users/UsersForm.js +169 -0
- package/admin/ui/views/Users/UsersForm.js.map +1 -0
- package/admin/ui/views/Users/UsersView.d.ts +2 -0
- package/admin/ui/views/Users/UsersView.js +14 -0
- package/admin/ui/views/Users/UsersView.js.map +1 -0
- package/admin/ui/views/Users/components/DeleteAction.d.ts +7 -0
- package/admin/ui/views/Users/components/DeleteAction.js +29 -0
- package/admin/ui/views/Users/components/DeleteAction.js.map +1 -0
- package/admin/ui/views/Users/hooks/useUserForm.d.ts +27 -0
- package/admin/ui/views/Users/hooks/useUserForm.js +101 -0
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -0
- package/admin/ui/views/Users/search.js +21 -0
- package/admin/ui/views/Users/search.js.map +1 -0
- package/admin/ui/views/Users/search.svg +20 -0
- package/admin/ui/views/utils.d.ts +3 -0
- package/admin/ui/views/utils.js +12 -0
- package/admin/ui/views/utils.js.map +1 -0
- package/api/CognitoApiFeature.d.ts +4 -0
- package/api/CognitoApiFeature.js +26 -0
- package/api/CognitoApiFeature.js.map +1 -0
- package/api/domain/Username.d.ts +4 -0
- package/api/domain/Username.js +8 -0
- package/api/domain/Username.js.map +1 -0
- package/api/domain/errors.d.ts +37 -0
- package/api/domain/errors.js +44 -0
- package/api/domain/errors.js.map +1 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.d.ts +15 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +63 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -0
- package/api/features/CognitoIdp/abstractions.d.ts +15 -0
- package/api/features/CognitoIdp/abstractions.js +5 -0
- package/api/features/CognitoIdp/abstractions.js.map +1 -0
- package/api/features/CognitoIdp/feature.d.ts +4 -0
- package/api/features/CognitoIdp/feature.js +11 -0
- package/api/features/CognitoIdp/feature.js.map +1 -0
- package/api/features/CognitoIdp/index.d.ts +2 -0
- package/api/features/CognitoIdp/index.js +2 -0
- package/api/features/CognitoService/CognitoService.d.ts +20 -0
- package/api/features/CognitoService/CognitoService.js +100 -0
- package/api/features/CognitoService/CognitoService.js.map +1 -0
- package/api/features/CognitoService/abstractions.d.ts +54 -0
- package/api/features/CognitoService/abstractions.js +6 -0
- package/api/features/CognitoService/abstractions.js.map +1 -0
- package/api/features/CognitoService/feature.d.ts +8 -0
- package/api/features/CognitoService/feature.js +13 -0
- package/api/features/CognitoService/feature.js.map +1 -0
- package/api/features/CognitoService/index.d.ts +1 -0
- package/api/features/CognitoService/index.js +1 -0
- package/api/features/CreateUser/CreateUserUseCase.d.ts +22 -0
- package/api/features/CreateUser/CreateUserUseCase.js +80 -0
- package/api/features/CreateUser/CreateUserUseCase.js.map +1 -0
- package/api/features/CreateUser/abstractions.d.ts +35 -0
- package/api/features/CreateUser/abstractions.js +5 -0
- package/api/features/CreateUser/abstractions.js.map +1 -0
- package/api/features/CreateUser/feature.d.ts +4 -0
- package/api/features/CreateUser/feature.js +11 -0
- package/api/features/CreateUser/feature.js.map +1 -0
- package/api/features/CreateUser/index.d.ts +2 -0
- package/api/features/CreateUser/index.js +2 -0
- package/api/features/CreateUser/schema.d.ts +15 -0
- package/api/features/CreateUser/schema.js +18 -0
- package/api/features/CreateUser/schema.js.map +1 -0
- package/api/features/DeleteUser/DeleteUserUseCase.d.ts +16 -0
- package/api/features/DeleteUser/DeleteUserUseCase.js +47 -0
- package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -0
- package/api/features/DeleteUser/abstractions.d.ts +19 -0
- package/api/features/DeleteUser/abstractions.js +5 -0
- package/api/features/DeleteUser/abstractions.js.map +1 -0
- package/api/features/DeleteUser/feature.d.ts +4 -0
- package/api/features/DeleteUser/feature.js +11 -0
- package/api/features/DeleteUser/feature.js.map +1 -0
- package/api/features/DeleteUser/index.d.ts +2 -0
- package/api/features/DeleteUser/index.js +2 -0
- package/api/features/UpdateUser/UpdateUserUseCase.d.ts +21 -0
- package/api/features/UpdateUser/UpdateUserUseCase.js +66 -0
- package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -0
- package/api/features/UpdateUser/abstractions.d.ts +33 -0
- package/api/features/UpdateUser/abstractions.js +5 -0
- package/api/features/UpdateUser/abstractions.js.map +1 -0
- package/api/features/UpdateUser/feature.d.ts +4 -0
- package/api/features/UpdateUser/feature.js +11 -0
- package/api/features/UpdateUser/feature.js.map +1 -0
- package/api/features/UpdateUser/index.d.ts +2 -0
- package/api/features/UpdateUser/index.js +2 -0
- package/api/features/UpdateUser/schema.d.ts +14 -0
- package/api/features/UpdateUser/schema.js +17 -0
- package/api/features/UpdateUser/schema.js.map +1 -0
- package/api/features/UserInstaller/UserInstaller.d.ts +27 -0
- package/api/features/UserInstaller/UserInstaller.js +48 -0
- package/api/features/UserInstaller/UserInstaller.js.map +1 -0
- package/api/features/UserInstaller/feature.d.ts +4 -0
- package/api/features/UserInstaller/feature.js +11 -0
- package/api/features/UserInstaller/feature.js.map +1 -0
- package/api/graphql/user.gql.d.ts +8 -0
- package/api/graphql/user.gql.js +143 -0
- package/api/graphql/user.gql.js.map +1 -0
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/infra/CognitoFederationPulumi.d.ts +8 -0
- package/infra/CognitoFederationPulumi.js +17 -0
- package/infra/CognitoFederationPulumi.js.map +1 -0
- package/package.json +51 -0
- package/static/svg/search.43fa797c.svg +20 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { makeAutoObservable, runInAction } from "mobx";
|
|
2
|
+
import { Amplify } from "aws-amplify";
|
|
3
|
+
import { confirmResetPassword, confirmSignIn, fetchAuthSession, resetPassword, signIn, signOut } from "aws-amplify/auth";
|
|
4
|
+
import { CognitoPresenter } from "./abstractions.js";
|
|
5
|
+
import { LogInUseCase } from "@webiny/app-admin/features/security/LogIn/index.js";
|
|
6
|
+
import { IdentityContext } from "@webiny/app-admin/features/security/IdentityContext/index.js";
|
|
7
|
+
import { CognitoSignInConfig } from "./CognitoSignInConfig.js";
|
|
8
|
+
const federatedDescription = "You will be taken to an external service to complete the sign-in process.";
|
|
9
|
+
class CognitoPresenterImpl {
|
|
10
|
+
constructor(identity, logInUseCase, signInConfig){
|
|
11
|
+
this.identity = identity;
|
|
12
|
+
this.logInUseCase = logInUseCase;
|
|
13
|
+
this.signInConfig = signInConfig;
|
|
14
|
+
this.authState = "signIn";
|
|
15
|
+
this.authData = null;
|
|
16
|
+
this.message = null;
|
|
17
|
+
this.checkingSession = false;
|
|
18
|
+
this.isLoggingIn = false;
|
|
19
|
+
this.formLoading = false;
|
|
20
|
+
this.initialized = false;
|
|
21
|
+
this.signInTitle = "Sign in";
|
|
22
|
+
this.signInDescription = void 0;
|
|
23
|
+
this.allowCredentialsLogin = true;
|
|
24
|
+
this.federatedProviders = [];
|
|
25
|
+
this.totpSharedSecret = "";
|
|
26
|
+
this.totpQrCodeUri = "";
|
|
27
|
+
makeAutoObservable(this);
|
|
28
|
+
}
|
|
29
|
+
get vm() {
|
|
30
|
+
const identity = this.identity.getIdentity();
|
|
31
|
+
return {
|
|
32
|
+
authState: this.authState,
|
|
33
|
+
checkingSession: this.checkingSession,
|
|
34
|
+
isLoggingIn: this.isLoggingIn,
|
|
35
|
+
isAuthenticated: identity.isAuthenticated,
|
|
36
|
+
signIn: {
|
|
37
|
+
isLoading: this.formLoading,
|
|
38
|
+
message: this.message,
|
|
39
|
+
title: this.signInTitle,
|
|
40
|
+
description: this.signInDescription,
|
|
41
|
+
allowCredentialsLogin: this.allowCredentialsLogin,
|
|
42
|
+
federatedProviders: this.federatedProviders
|
|
43
|
+
},
|
|
44
|
+
requestPasswordResetCode: {
|
|
45
|
+
isLoading: this.formLoading,
|
|
46
|
+
message: this.message
|
|
47
|
+
},
|
|
48
|
+
passwordResetCodeSent: {
|
|
49
|
+
isLoading: this.formLoading,
|
|
50
|
+
message: this.message
|
|
51
|
+
},
|
|
52
|
+
setNewPassword: {
|
|
53
|
+
isLoading: this.formLoading,
|
|
54
|
+
message: this.message
|
|
55
|
+
},
|
|
56
|
+
requireNewPassword: {
|
|
57
|
+
isLoading: this.formLoading,
|
|
58
|
+
requiredAttributes: this.authData && this.authData.requiredAttributes || []
|
|
59
|
+
},
|
|
60
|
+
confirmTotpCode: {
|
|
61
|
+
isLoading: this.formLoading,
|
|
62
|
+
message: this.message
|
|
63
|
+
},
|
|
64
|
+
setupTotp: {
|
|
65
|
+
isLoading: this.formLoading,
|
|
66
|
+
sharedSecret: this.totpSharedSecret,
|
|
67
|
+
qrCodeUri: this.totpQrCodeUri,
|
|
68
|
+
message: this.message
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async init(params) {
|
|
73
|
+
if (this.initialized) return;
|
|
74
|
+
let oauthConfig;
|
|
75
|
+
if (this.signInConfig) {
|
|
76
|
+
const config = await this.signInConfig.getConfig();
|
|
77
|
+
runInAction(()=>{
|
|
78
|
+
this.signInTitle = config.title ?? "Sign in";
|
|
79
|
+
this.signInDescription = config.description;
|
|
80
|
+
if (!config.description && !config.allowCredentialsLogin) this.signInDescription = federatedDescription;
|
|
81
|
+
this.allowCredentialsLogin = config.allowCredentialsLogin;
|
|
82
|
+
this.federatedProviders = config.providers;
|
|
83
|
+
});
|
|
84
|
+
const domain = process.env.REACT_APP_USER_POOL_DOMAIN;
|
|
85
|
+
if (domain) oauthConfig = {
|
|
86
|
+
Cognito: {
|
|
87
|
+
userPoolId: params.userPoolId,
|
|
88
|
+
userPoolClientId: params.clientId,
|
|
89
|
+
loginWith: {
|
|
90
|
+
oauth: {
|
|
91
|
+
domain,
|
|
92
|
+
redirectSignIn: config.oauth.redirectSignIn,
|
|
93
|
+
redirectSignOut: config.oauth.redirectSignOut,
|
|
94
|
+
scopes: config.oauth.scopes,
|
|
95
|
+
responseType: config.oauth.responseType
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
Amplify.configure({
|
|
102
|
+
Auth: oauthConfig ?? {
|
|
103
|
+
Cognito: {
|
|
104
|
+
userPoolId: params.userPoolId,
|
|
105
|
+
userPoolClientId: params.clientId
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this.initialized = true;
|
|
110
|
+
await this.checkUrl();
|
|
111
|
+
}
|
|
112
|
+
async signIn(username, password) {
|
|
113
|
+
runInAction(()=>{
|
|
114
|
+
this.formLoading = true;
|
|
115
|
+
this.message = null;
|
|
116
|
+
});
|
|
117
|
+
const usernameOrPassword = [
|
|
118
|
+
"UserNotFoundException",
|
|
119
|
+
"NotAuthorizedException"
|
|
120
|
+
];
|
|
121
|
+
try {
|
|
122
|
+
const result = await signIn({
|
|
123
|
+
username,
|
|
124
|
+
password
|
|
125
|
+
});
|
|
126
|
+
const { nextStep } = result;
|
|
127
|
+
if ("CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED" === nextStep.signInStep) runInAction(()=>{
|
|
128
|
+
this.authState = "requireNewPassword";
|
|
129
|
+
this.authData = {
|
|
130
|
+
requiredAttributes: nextStep.missingAttributes || []
|
|
131
|
+
};
|
|
132
|
+
this.formLoading = false;
|
|
133
|
+
});
|
|
134
|
+
else if ("CONFIRM_SIGN_IN_WITH_TOTP_CODE" === nextStep.signInStep) runInAction(()=>{
|
|
135
|
+
this.authState = "confirmTotpCode";
|
|
136
|
+
this.formLoading = false;
|
|
137
|
+
});
|
|
138
|
+
else if ("CONTINUE_SIGN_IN_WITH_TOTP_SETUP" === nextStep.signInStep) {
|
|
139
|
+
const totpSetup = nextStep.totpSetupDetails;
|
|
140
|
+
const uri = totpSetup.getSetupUri("Webiny").toString();
|
|
141
|
+
runInAction(()=>{
|
|
142
|
+
this.totpSharedSecret = totpSetup.sharedSecret;
|
|
143
|
+
this.totpQrCodeUri = uri;
|
|
144
|
+
this.authState = "setupTotp";
|
|
145
|
+
this.formLoading = false;
|
|
146
|
+
});
|
|
147
|
+
} else {
|
|
148
|
+
await this.handleSignedIn();
|
|
149
|
+
runInAction(()=>{
|
|
150
|
+
this.formLoading = false;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
let message = error.message;
|
|
155
|
+
if (usernameOrPassword.includes(error.name)) message = "Incorrect username or password.";
|
|
156
|
+
runInAction(()=>{
|
|
157
|
+
this.message = {
|
|
158
|
+
title: "Login Failed",
|
|
159
|
+
text: message,
|
|
160
|
+
type: "danger"
|
|
161
|
+
};
|
|
162
|
+
this.formLoading = false;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async confirmNewPassword(password, requiredAttributes) {
|
|
167
|
+
runInAction(()=>{
|
|
168
|
+
this.formLoading = true;
|
|
169
|
+
this.message = null;
|
|
170
|
+
});
|
|
171
|
+
try {
|
|
172
|
+
await confirmSignIn({
|
|
173
|
+
challengeResponse: password,
|
|
174
|
+
options: {
|
|
175
|
+
userAttributes: requiredAttributes
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
await this.handleSignedIn();
|
|
179
|
+
} catch (error) {
|
|
180
|
+
runInAction(()=>{
|
|
181
|
+
this.message = {
|
|
182
|
+
title: "Error",
|
|
183
|
+
text: error.message,
|
|
184
|
+
type: "danger"
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
} finally{
|
|
188
|
+
runInAction(()=>{
|
|
189
|
+
this.formLoading = false;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async requestPasswordReset(username) {
|
|
194
|
+
runInAction(()=>{
|
|
195
|
+
this.formLoading = true;
|
|
196
|
+
this.message = null;
|
|
197
|
+
});
|
|
198
|
+
try {
|
|
199
|
+
await resetPassword({
|
|
200
|
+
username
|
|
201
|
+
});
|
|
202
|
+
} catch {} finally{
|
|
203
|
+
runInAction(()=>{
|
|
204
|
+
this.authState = "passwordResetCodeSent";
|
|
205
|
+
this.authData = {
|
|
206
|
+
username
|
|
207
|
+
};
|
|
208
|
+
this.formLoading = false;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
async resendPasswordResetCode() {
|
|
213
|
+
const username = this.authData?.username;
|
|
214
|
+
if ("passwordResetCodeSent" !== this.authState || !username) return;
|
|
215
|
+
await this.requestPasswordReset(username);
|
|
216
|
+
runInAction(()=>{
|
|
217
|
+
this.message = {
|
|
218
|
+
title: "Code Resent",
|
|
219
|
+
text: "Password reset code has been resent to your email address. Please check your inbox!",
|
|
220
|
+
type: "success"
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async confirmPasswordReset(code, password) {
|
|
225
|
+
const username = this.authData?.username;
|
|
226
|
+
if (!username) return;
|
|
227
|
+
runInAction(()=>{
|
|
228
|
+
this.formLoading = true;
|
|
229
|
+
this.message = null;
|
|
230
|
+
});
|
|
231
|
+
try {
|
|
232
|
+
await confirmResetPassword({
|
|
233
|
+
username,
|
|
234
|
+
confirmationCode: code,
|
|
235
|
+
newPassword: password
|
|
236
|
+
});
|
|
237
|
+
runInAction(()=>{
|
|
238
|
+
this.authState = "signIn";
|
|
239
|
+
this.message = {
|
|
240
|
+
title: "Password Reset",
|
|
241
|
+
text: "You can now sign in with your new password",
|
|
242
|
+
type: "success"
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
} catch (error) {
|
|
246
|
+
runInAction(()=>{
|
|
247
|
+
this.message = {
|
|
248
|
+
title: "Error",
|
|
249
|
+
text: error.message,
|
|
250
|
+
type: "danger"
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
} finally{
|
|
254
|
+
runInAction(()=>{
|
|
255
|
+
this.formLoading = false;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async confirmTotpCode(code) {
|
|
260
|
+
runInAction(()=>{
|
|
261
|
+
this.formLoading = true;
|
|
262
|
+
this.message = null;
|
|
263
|
+
});
|
|
264
|
+
try {
|
|
265
|
+
await confirmSignIn({
|
|
266
|
+
challengeResponse: code
|
|
267
|
+
});
|
|
268
|
+
await this.handleSignedIn();
|
|
269
|
+
} catch (error) {
|
|
270
|
+
runInAction(()=>{
|
|
271
|
+
this.message = {
|
|
272
|
+
title: "Verification Failed",
|
|
273
|
+
text: error.message,
|
|
274
|
+
type: "danger"
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
} finally{
|
|
278
|
+
runInAction(()=>{
|
|
279
|
+
this.formLoading = false;
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async verifyTotpSetup(code) {
|
|
284
|
+
runInAction(()=>{
|
|
285
|
+
this.formLoading = true;
|
|
286
|
+
this.message = null;
|
|
287
|
+
});
|
|
288
|
+
try {
|
|
289
|
+
await confirmSignIn({
|
|
290
|
+
challengeResponse: code
|
|
291
|
+
});
|
|
292
|
+
await this.handleSignedIn();
|
|
293
|
+
} catch (error) {
|
|
294
|
+
runInAction(()=>{
|
|
295
|
+
this.message = {
|
|
296
|
+
title: "Setup Failed",
|
|
297
|
+
text: error.message,
|
|
298
|
+
type: "danger"
|
|
299
|
+
};
|
|
300
|
+
});
|
|
301
|
+
} finally{
|
|
302
|
+
runInAction(()=>{
|
|
303
|
+
this.formLoading = false;
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
showSignIn() {
|
|
308
|
+
this.authState = "signIn";
|
|
309
|
+
this.authData = null;
|
|
310
|
+
this.message = null;
|
|
311
|
+
}
|
|
312
|
+
showRequestPasswordResetCode() {
|
|
313
|
+
this.authState = "requestPasswordResetCode";
|
|
314
|
+
this.message = null;
|
|
315
|
+
}
|
|
316
|
+
showSetNewPassword() {
|
|
317
|
+
this.authState = "setNewPassword";
|
|
318
|
+
this.message = null;
|
|
319
|
+
}
|
|
320
|
+
async handleSignedIn() {
|
|
321
|
+
runInAction(()=>{
|
|
322
|
+
this.isLoggingIn = true;
|
|
323
|
+
});
|
|
324
|
+
try {
|
|
325
|
+
await this.logInUseCase.execute({
|
|
326
|
+
idTokenProvider: async ()=>{
|
|
327
|
+
const session = await fetchAuthSession();
|
|
328
|
+
const idToken = session.tokens?.idToken;
|
|
329
|
+
if (!idToken) throw new Error("No ID token available.");
|
|
330
|
+
return idToken.toString();
|
|
331
|
+
},
|
|
332
|
+
logoutCallback: ()=>{
|
|
333
|
+
signOut();
|
|
334
|
+
runInAction(()=>{
|
|
335
|
+
this.authState = "signIn";
|
|
336
|
+
this.authData = null;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
runInAction(()=>{
|
|
341
|
+
this.authState = "signedIn";
|
|
342
|
+
});
|
|
343
|
+
} catch (error) {
|
|
344
|
+
console.error("Error during sign in:", error);
|
|
345
|
+
runInAction(()=>{
|
|
346
|
+
this.authState = "signIn";
|
|
347
|
+
});
|
|
348
|
+
} finally{
|
|
349
|
+
runInAction(()=>{
|
|
350
|
+
this.isLoggingIn = false;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async checkUrl() {
|
|
355
|
+
return this.checkSession();
|
|
356
|
+
}
|
|
357
|
+
async checkSession() {
|
|
358
|
+
runInAction(()=>{
|
|
359
|
+
this.checkingSession = true;
|
|
360
|
+
});
|
|
361
|
+
try {
|
|
362
|
+
const session = await fetchAuthSession();
|
|
363
|
+
if (session.tokens) this.handleSignedIn();
|
|
364
|
+
} catch {} finally{
|
|
365
|
+
runInAction(()=>{
|
|
366
|
+
this.checkingSession = false;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const CognitoPresenter_CognitoPresenter = CognitoPresenter.createImplementation({
|
|
372
|
+
implementation: CognitoPresenterImpl,
|
|
373
|
+
dependencies: [
|
|
374
|
+
IdentityContext,
|
|
375
|
+
LogInUseCase,
|
|
376
|
+
[
|
|
377
|
+
CognitoSignInConfig,
|
|
378
|
+
{
|
|
379
|
+
optional: true
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
]
|
|
383
|
+
});
|
|
384
|
+
export { CognitoPresenter_CognitoPresenter as CognitoPresenter };
|
|
385
|
+
|
|
386
|
+
//# sourceMappingURL=CognitoPresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/CognitoPresenter.js","sources":["../../../../src/admin/presentation/Cognito/CognitoPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { Amplify } from \"aws-amplify\";\nimport {\n signIn,\n signOut,\n confirmSignIn,\n resetPassword,\n confirmResetPassword,\n fetchAuthSession\n} from \"aws-amplify/auth\";\nimport {\n CognitoPresenter as CognitoPresenterAbstraction,\n AuthState,\n AuthData,\n AuthMessage,\n ICognitoInitParams\n} from \"./abstractions.js\";\nimport { LogInUseCase } from \"@webiny/app-admin/features/security/LogIn/index.js\";\nimport { IdentityContext } from \"@webiny/app-admin/features/security/IdentityContext/index.js\";\nimport { CognitoSignInConfig } from \"./CognitoSignInConfig.js\";\n\nconst federatedDescription =\n \"You will be taken to an external service to complete the sign-in process.\";\n\nclass CognitoPresenterImpl implements CognitoPresenterAbstraction.Interface {\n private authState: AuthState = \"signIn\";\n private authData: AuthData | null = null;\n private message: AuthMessage | null = null;\n private checkingSession = false;\n private isLoggingIn = false;\n private formLoading = false;\n private initialized = false;\n\n private signInTitle = \"Sign in\";\n private signInDescription: string | undefined = undefined;\n private allowCredentialsLogin = true;\n private federatedProviders: CognitoSignInConfig.FederatedProvider[] = [];\n\n private totpSharedSecret = \"\";\n private totpQrCodeUri = \"\";\n\n constructor(\n private identity: IdentityContext.Interface,\n private logInUseCase: LogInUseCase.Interface,\n private signInConfig: CognitoSignInConfig.Interface | undefined\n ) {\n makeAutoObservable(this);\n }\n\n get vm() {\n const identity = this.identity.getIdentity();\n\n return {\n authState: this.authState,\n checkingSession: this.checkingSession,\n isLoggingIn: this.isLoggingIn,\n isAuthenticated: identity.isAuthenticated,\n\n // View-specific VMs\n signIn: {\n isLoading: this.formLoading,\n message: this.message,\n title: this.signInTitle,\n description: this.signInDescription,\n allowCredentialsLogin: this.allowCredentialsLogin,\n federatedProviders: this.federatedProviders\n },\n requestPasswordResetCode: {\n isLoading: this.formLoading,\n message: this.message\n },\n passwordResetCodeSent: {\n isLoading: this.formLoading,\n message: this.message\n },\n setNewPassword: {\n isLoading: this.formLoading,\n message: this.message\n },\n requireNewPassword: {\n isLoading: this.formLoading,\n requiredAttributes: (this.authData && this.authData.requiredAttributes) || []\n },\n confirmTotpCode: {\n isLoading: this.formLoading,\n message: this.message\n },\n setupTotp: {\n isLoading: this.formLoading,\n sharedSecret: this.totpSharedSecret,\n qrCodeUri: this.totpQrCodeUri,\n message: this.message\n }\n };\n }\n\n async init(params: ICognitoInitParams): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n let oauthConfig:\n | { Cognito: { userPoolId: string; userPoolClientId: string; loginWith: any } }\n | undefined;\n\n if (this.signInConfig) {\n const config = await this.signInConfig.getConfig();\n\n runInAction(() => {\n this.signInTitle = config.title ?? \"Sign in\";\n this.signInDescription = config.description;\n\n if (!config.description && !config.allowCredentialsLogin) {\n this.signInDescription = federatedDescription;\n }\n\n this.allowCredentialsLogin = config.allowCredentialsLogin;\n this.federatedProviders = config.providers;\n });\n\n const domain = process.env.REACT_APP_USER_POOL_DOMAIN;\n if (domain) {\n oauthConfig = {\n Cognito: {\n userPoolId: params.userPoolId,\n userPoolClientId: params.clientId,\n loginWith: {\n oauth: {\n domain,\n redirectSignIn: config.oauth.redirectSignIn,\n redirectSignOut: config.oauth.redirectSignOut,\n scopes: config.oauth.scopes,\n responseType: config.oauth.responseType\n }\n }\n }\n };\n }\n }\n\n Amplify.configure({\n Auth: oauthConfig ?? {\n Cognito: {\n userPoolId: params.userPoolId,\n userPoolClientId: params.clientId\n }\n }\n });\n this.initialized = true;\n\n await this.checkUrl();\n }\n\n // Public API\n async signIn(username: string, password: string): Promise<void> {\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n const usernameOrPassword = [\"UserNotFoundException\", \"NotAuthorizedException\"];\n\n try {\n const result = await signIn({ username, password });\n const { nextStep } = result;\n\n if (nextStep.signInStep === \"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED\") {\n runInAction(() => {\n this.authState = \"requireNewPassword\";\n this.authData = {\n requiredAttributes: nextStep.missingAttributes || []\n };\n this.formLoading = false;\n });\n } else if (nextStep.signInStep === \"CONFIRM_SIGN_IN_WITH_TOTP_CODE\") {\n runInAction(() => {\n this.authState = \"confirmTotpCode\";\n this.formLoading = false;\n });\n } else if (nextStep.signInStep === \"CONTINUE_SIGN_IN_WITH_TOTP_SETUP\") {\n const totpSetup = nextStep.totpSetupDetails;\n const uri = totpSetup.getSetupUri(\"Webiny\").toString();\n runInAction(() => {\n this.totpSharedSecret = totpSetup.sharedSecret;\n this.totpQrCodeUri = uri;\n this.authState = \"setupTotp\";\n this.formLoading = false;\n });\n } else {\n await this.handleSignedIn();\n runInAction(() => {\n this.formLoading = false;\n });\n }\n } catch (error) {\n let message = error.message;\n\n if (usernameOrPassword.includes(error.name)) {\n message = \"Incorrect username or password.\";\n }\n runInAction(() => {\n this.message = {\n title: \"Login Failed\",\n text: message,\n type: \"danger\"\n };\n this.formLoading = false;\n });\n }\n }\n\n async confirmNewPassword(password: string, requiredAttributes: any): Promise<void> {\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n try {\n await confirmSignIn({\n challengeResponse: password,\n options: { userAttributes: requiredAttributes }\n });\n await this.handleSignedIn();\n } catch (error) {\n runInAction(() => {\n this.message = {\n title: \"Error\",\n text: error.message,\n type: \"danger\"\n };\n });\n } finally {\n runInAction(() => {\n this.formLoading = false;\n });\n }\n }\n\n async requestPasswordReset(username: string): Promise<void> {\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n try {\n await resetPassword({ username });\n } catch {\n // We ignore errors and pretend that everything went fine.\n // Showing an error would give a potential attacker information about which usernames exist (or not).\n // This way it's more difficult to exploit the process.\n } finally {\n runInAction(() => {\n this.authState = \"passwordResetCodeSent\";\n this.authData = { username };\n this.formLoading = false;\n });\n }\n }\n\n async resendPasswordResetCode(): Promise<void> {\n const username = this.authData?.username;\n if (this.authState !== \"passwordResetCodeSent\" || !username) {\n return;\n }\n\n await this.requestPasswordReset(username!);\n runInAction(() => {\n this.message = {\n title: \"Code Resent\",\n text: \"Password reset code has been resent to your email address. Please check your inbox!\",\n type: \"success\"\n };\n });\n }\n\n async confirmPasswordReset(code: string, password: string): Promise<void> {\n const username = this.authData?.username;\n if (!username) {\n return;\n }\n\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n try {\n await confirmResetPassword({\n username,\n confirmationCode: code,\n newPassword: password\n });\n runInAction(() => {\n this.authState = \"signIn\";\n this.message = {\n title: \"Password Reset\",\n text: \"You can now sign in with your new password\",\n type: \"success\"\n };\n });\n } catch (error) {\n runInAction(() => {\n this.message = {\n title: \"Error\",\n text: error.message,\n type: \"danger\"\n };\n });\n } finally {\n runInAction(() => {\n this.formLoading = false;\n });\n }\n }\n\n async confirmTotpCode(code: string): Promise<void> {\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n try {\n await confirmSignIn({ challengeResponse: code });\n await this.handleSignedIn();\n } catch (error) {\n runInAction(() => {\n this.message = {\n title: \"Verification Failed\",\n text: error.message,\n type: \"danger\"\n };\n });\n } finally {\n runInAction(() => {\n this.formLoading = false;\n });\n }\n }\n\n async verifyTotpSetup(code: string): Promise<void> {\n runInAction(() => {\n this.formLoading = true;\n this.message = null;\n });\n\n try {\n await confirmSignIn({ challengeResponse: code });\n await this.handleSignedIn();\n } catch (error) {\n runInAction(() => {\n this.message = {\n title: \"Setup Failed\",\n text: error.message,\n type: \"danger\"\n };\n });\n } finally {\n runInAction(() => {\n this.formLoading = false;\n });\n }\n }\n\n showSignIn(): void {\n this.authState = \"signIn\";\n this.authData = null;\n this.message = null;\n }\n\n showRequestPasswordResetCode(): void {\n this.authState = \"requestPasswordResetCode\";\n this.message = null;\n }\n\n showSetNewPassword(): void {\n this.authState = \"setNewPassword\";\n this.message = null;\n }\n\n // Private/internal methods\n private async handleSignedIn(): Promise<void> {\n runInAction(() => {\n this.isLoggingIn = true;\n });\n\n try {\n await this.logInUseCase.execute({\n idTokenProvider: async () => {\n const session = await fetchAuthSession();\n const idToken = session.tokens?.idToken;\n if (!idToken) {\n throw new Error(\"No ID token available.\");\n }\n return idToken.toString();\n },\n logoutCallback: () => {\n signOut();\n runInAction(() => {\n this.authState = \"signIn\";\n this.authData = null;\n });\n }\n });\n\n runInAction(() => {\n this.authState = \"signedIn\";\n });\n } catch (error) {\n console.error(\"Error during sign in:\", error);\n runInAction(() => {\n this.authState = \"signIn\";\n });\n } finally {\n runInAction(() => {\n this.isLoggingIn = false;\n });\n }\n }\n\n private async checkUrl(): Promise<void> {\n return this.checkSession();\n }\n\n private async checkSession(): Promise<void> {\n runInAction(() => {\n this.checkingSession = true;\n });\n\n try {\n const session = await fetchAuthSession();\n if (session.tokens) {\n // We don't need to `await`, we simply start a separate \"branch\" of execution.\n this.handleSignedIn();\n }\n } catch {\n // Not authenticated, stay on signIn\n } finally {\n runInAction(() => {\n this.checkingSession = false;\n });\n }\n }\n}\n\nexport const CognitoPresenter = CognitoPresenterAbstraction.createImplementation({\n implementation: CognitoPresenterImpl,\n dependencies: [IdentityContext, LogInUseCase, [CognitoSignInConfig, { optional: true }]]\n});\n"],"names":["federatedDescription","CognitoPresenterImpl","identity","logInUseCase","signInConfig","undefined","makeAutoObservable","params","oauthConfig","config","runInAction","domain","process","Amplify","username","password","usernameOrPassword","result","signIn","nextStep","totpSetup","uri","error","message","requiredAttributes","confirmSignIn","resetPassword","code","confirmResetPassword","session","fetchAuthSession","idToken","Error","signOut","console","CognitoPresenter","CognitoPresenterAbstraction","IdentityContext","LogInUseCase","CognitoSignInConfig"],"mappings":";;;;;;;AAqBA,MAAMA,uBACF;AAEJ,MAAMC;IAiBF,YACYC,QAAmC,EACnCC,YAAoC,EACpCC,YAAuD,CACjE;aAHUF,QAAQ,GAARA;aACAC,YAAY,GAAZA;aACAC,YAAY,GAAZA;aAnBJ,SAAS,GAAc;aACvB,QAAQ,GAAoB;aAC5B,OAAO,GAAuB;aAC9B,eAAe,GAAG;aAClB,WAAW,GAAG;aACd,WAAW,GAAG;aACd,WAAW,GAAG;aAEd,WAAW,GAAG;aACd,iBAAiB,GAAuBC;aACxC,qBAAqB,GAAG;aACxB,kBAAkB,GAA4C,EAAE;aAEhE,gBAAgB,GAAG;aACnB,aAAa,GAAG;QAOpBC,mBAAmB,IAAI;IAC3B;IAEA,IAAI,KAAK;QACL,MAAMJ,WAAW,IAAI,CAAC,QAAQ,CAAC,WAAW;QAE1C,OAAO;YACH,WAAW,IAAI,CAAC,SAAS;YACzB,iBAAiB,IAAI,CAAC,eAAe;YACrC,aAAa,IAAI,CAAC,WAAW;YAC7B,iBAAiBA,SAAS,eAAe;YAGzC,QAAQ;gBACJ,WAAW,IAAI,CAAC,WAAW;gBAC3B,SAAS,IAAI,CAAC,OAAO;gBACrB,OAAO,IAAI,CAAC,WAAW;gBACvB,aAAa,IAAI,CAAC,iBAAiB;gBACnC,uBAAuB,IAAI,CAAC,qBAAqB;gBACjD,oBAAoB,IAAI,CAAC,kBAAkB;YAC/C;YACA,0BAA0B;gBACtB,WAAW,IAAI,CAAC,WAAW;gBAC3B,SAAS,IAAI,CAAC,OAAO;YACzB;YACA,uBAAuB;gBACnB,WAAW,IAAI,CAAC,WAAW;gBAC3B,SAAS,IAAI,CAAC,OAAO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ACvB;QACJ;IACJ;IAEA,MAAc,WAA0B;QACpC,OAAO,IAAI,CAAC,YAAY;IAC5B;IAEA,MAAc,eAA8B;QACxCA,YAAY;YACR,IAAI,CAAC,eAAe,GAAG;QAC3B;QAEA,IAAI;YACA,MAAMmB,UAAU,MAAMC;YACtB,IAAID,QAAQ,MAAM,EAEd,IAAI,CAAC,cAAc;QAE3B,EAAE,OAAM,CAER,SAAU;YACNnB,YAAY;gBACR,IAAI,CAAC,eAAe,GAAG;YAC3B;QACJ;IACJ;AACJ;AAEO,MAAMyB,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBnC;IAChB,cAAc;QAACoC;QAAiBC;QAAc;YAACC;YAAqB;gBAAE,UAAU;YAAK;SAAE;KAAC;AAC5F"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface SignInProps {
|
|
3
|
+
signIn: () => void;
|
|
4
|
+
}
|
|
5
|
+
export type IFederatedProvider = {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
} | {
|
|
9
|
+
name: string;
|
|
10
|
+
component: React.FC<SignInProps>;
|
|
11
|
+
};
|
|
12
|
+
export interface ICognitoSignInConfig {
|
|
13
|
+
getConfig(): Promise<{
|
|
14
|
+
oauth: {
|
|
15
|
+
scopes: string[];
|
|
16
|
+
redirectSignIn: string[];
|
|
17
|
+
redirectSignOut: string[];
|
|
18
|
+
responseType: "code" | "token";
|
|
19
|
+
};
|
|
20
|
+
allowCredentialsLogin: boolean;
|
|
21
|
+
providers: IFederatedProvider[];
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export declare const CognitoSignInConfig: import("@webiny/di").Abstraction<ICognitoSignInConfig>;
|
|
27
|
+
export declare namespace CognitoSignInConfig {
|
|
28
|
+
type Interface = ICognitoSignInConfig;
|
|
29
|
+
type Config = Awaited<ReturnType<ICognitoSignInConfig["getConfig"]>>;
|
|
30
|
+
type FederatedProvider = IFederatedProvider;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/CognitoSignInConfig.js","sources":["../../../../src/admin/presentation/Cognito/CognitoSignInConfig.ts"],"sourcesContent":["import type React from \"react\";\nimport { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface SignInProps {\n signIn: () => void;\n}\n\nexport type IFederatedProvider =\n | { name: string; label: string }\n | { name: string; component: React.FC<SignInProps> };\n\nexport interface ICognitoSignInConfig {\n getConfig(): Promise<{\n oauth: {\n scopes: string[];\n redirectSignIn: string[];\n redirectSignOut: string[];\n responseType: \"code\" | \"token\";\n };\n allowCredentialsLogin: boolean;\n providers: IFederatedProvider[];\n title?: string;\n description?: string;\n }>;\n}\n\nexport const CognitoSignInConfig = createAbstraction<ICognitoSignInConfig>(\"CognitoSignInConfig\");\n\nexport namespace CognitoSignInConfig {\n export type Interface = ICognitoSignInConfig;\n export type Config = Awaited<ReturnType<ICognitoSignInConfig[\"getConfig\"]>>;\n export type FederatedProvider = IFederatedProvider;\n}\n"],"names":["CognitoSignInConfig","createAbstraction"],"mappings":";AA0BO,MAAMA,sBAAsBC,kBAAwC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { IFederatedProvider } from "./CognitoSignInConfig.js";
|
|
2
|
+
export type AuthState = "signIn" | "signedIn" | "signedOut" | "requestPasswordResetCode" | "passwordResetCodeSent" | "setNewPassword" | "requireNewPassword" | "confirmTotpCode" | "setupTotp";
|
|
3
|
+
export interface AuthDataVerified {
|
|
4
|
+
email?: string;
|
|
5
|
+
phone_number?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthDataUnverified {
|
|
8
|
+
email?: string;
|
|
9
|
+
phone_number?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AuthData {
|
|
12
|
+
username?: string;
|
|
13
|
+
verified?: AuthDataVerified;
|
|
14
|
+
unverified?: AuthDataUnverified;
|
|
15
|
+
requiredAttributes?: string[];
|
|
16
|
+
[key: string]: string | null | boolean | undefined | string[] | AuthDataVerified | AuthDataUnverified;
|
|
17
|
+
}
|
|
18
|
+
export interface AuthMessage {
|
|
19
|
+
title: string;
|
|
20
|
+
text: string;
|
|
21
|
+
type: "success" | "info" | "warning" | "danger";
|
|
22
|
+
}
|
|
23
|
+
export interface ICognitoInitParams {
|
|
24
|
+
region: string;
|
|
25
|
+
userPoolId: string;
|
|
26
|
+
clientId: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SignInVM {
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
message: AuthMessage | null;
|
|
31
|
+
title: string;
|
|
32
|
+
description: string | undefined;
|
|
33
|
+
allowCredentialsLogin: boolean;
|
|
34
|
+
federatedProviders: IFederatedProvider[];
|
|
35
|
+
}
|
|
36
|
+
export interface RequireNewPasswordVM {
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
requiredAttributes: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface RequestPasswordResetCodeVM {
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
message: AuthMessage | null;
|
|
43
|
+
}
|
|
44
|
+
export interface PasswordResetCodeSentVM {
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
message: AuthMessage | null;
|
|
47
|
+
}
|
|
48
|
+
export interface SetNewPasswordVM {
|
|
49
|
+
isLoading: boolean;
|
|
50
|
+
message: AuthMessage | null;
|
|
51
|
+
}
|
|
52
|
+
export interface ConfirmTotpCodeVM {
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
message: AuthMessage | null;
|
|
55
|
+
}
|
|
56
|
+
export interface SetupTotpVM {
|
|
57
|
+
isLoading: boolean;
|
|
58
|
+
sharedSecret: string;
|
|
59
|
+
qrCodeUri: string;
|
|
60
|
+
message: AuthMessage | null;
|
|
61
|
+
}
|
|
62
|
+
export interface ICognitoPresenter {
|
|
63
|
+
vm: {
|
|
64
|
+
authState: AuthState;
|
|
65
|
+
checkingSession: boolean;
|
|
66
|
+
isLoggingIn: boolean;
|
|
67
|
+
isAuthenticated: boolean;
|
|
68
|
+
signIn: SignInVM;
|
|
69
|
+
requireNewPassword: RequireNewPasswordVM;
|
|
70
|
+
requestPasswordResetCode: RequestPasswordResetCodeVM;
|
|
71
|
+
passwordResetCodeSent: PasswordResetCodeSentVM;
|
|
72
|
+
setNewPassword: SetNewPasswordVM;
|
|
73
|
+
confirmTotpCode: ConfirmTotpCodeVM;
|
|
74
|
+
setupTotp: SetupTotpVM;
|
|
75
|
+
};
|
|
76
|
+
init(params: ICognitoInitParams): Promise<void>;
|
|
77
|
+
signIn(username: string, password: string): Promise<void>;
|
|
78
|
+
confirmNewPassword(password: string, requiredAttributes: any): Promise<void>;
|
|
79
|
+
requestPasswordReset(username: string): Promise<void>;
|
|
80
|
+
resendPasswordResetCode(): Promise<void>;
|
|
81
|
+
confirmPasswordReset(code: string, password: string): Promise<void>;
|
|
82
|
+
confirmTotpCode(code: string): Promise<void>;
|
|
83
|
+
verifyTotpSetup(code: string): Promise<void>;
|
|
84
|
+
showSignIn(): void;
|
|
85
|
+
showRequestPasswordResetCode(): void;
|
|
86
|
+
showSetNewPassword(): void;
|
|
87
|
+
}
|
|
88
|
+
export declare const CognitoPresenter: import("@webiny/di").Abstraction<ICognitoPresenter>;
|
|
89
|
+
export declare namespace CognitoPresenter {
|
|
90
|
+
type Interface = ICognitoPresenter;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/abstractions.js","sources":["../../../../src/admin/presentation/Cognito/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IFederatedProvider } from \"./CognitoSignInConfig.js\";\n\nexport type AuthState =\n | \"signIn\"\n | \"signedIn\"\n | \"signedOut\"\n | \"requestPasswordResetCode\"\n | \"passwordResetCodeSent\"\n | \"setNewPassword\"\n | \"requireNewPassword\"\n | \"confirmTotpCode\"\n | \"setupTotp\";\n\nexport interface AuthDataVerified {\n email?: string;\n phone_number?: string;\n}\n\nexport interface AuthDataUnverified {\n email?: string;\n phone_number?: string;\n}\n\nexport interface AuthData {\n username?: string;\n verified?: AuthDataVerified;\n unverified?: AuthDataUnverified;\n requiredAttributes?: string[];\n [key: string]:\n | string\n | null\n | boolean\n | undefined\n | string[]\n | AuthDataVerified\n | AuthDataUnverified;\n}\n\nexport interface AuthMessage {\n title: string;\n text: string;\n type: \"success\" | \"info\" | \"warning\" | \"danger\";\n}\n\nexport interface ICognitoInitParams {\n region: string;\n userPoolId: string;\n clientId: string;\n}\n\nexport interface SignInVM {\n isLoading: boolean;\n message: AuthMessage | null;\n title: string;\n description: string | undefined;\n allowCredentialsLogin: boolean;\n federatedProviders: IFederatedProvider[];\n}\n\nexport interface RequireNewPasswordVM {\n isLoading: boolean;\n requiredAttributes: string[];\n}\n\nexport interface RequestPasswordResetCodeVM {\n isLoading: boolean;\n message: AuthMessage | null;\n}\n\nexport interface PasswordResetCodeSentVM {\n isLoading: boolean;\n message: AuthMessage | null;\n}\n\nexport interface SetNewPasswordVM {\n isLoading: boolean;\n message: AuthMessage | null;\n}\n\nexport interface ConfirmTotpCodeVM {\n isLoading: boolean;\n message: AuthMessage | null;\n}\n\nexport interface SetupTotpVM {\n isLoading: boolean;\n sharedSecret: string;\n qrCodeUri: string;\n message: AuthMessage | null;\n}\n\nexport interface ICognitoPresenter {\n vm: {\n authState: AuthState;\n checkingSession: boolean;\n isLoggingIn: boolean;\n isAuthenticated: boolean;\n signIn: SignInVM;\n requireNewPassword: RequireNewPasswordVM;\n requestPasswordResetCode: RequestPasswordResetCodeVM;\n passwordResetCodeSent: PasswordResetCodeSentVM;\n setNewPassword: SetNewPasswordVM;\n confirmTotpCode: ConfirmTotpCodeVM;\n setupTotp: SetupTotpVM;\n };\n\n // Lifecycle\n init(params: ICognitoInitParams): Promise<void>;\n\n // Authentication actions\n signIn(username: string, password: string): Promise<void>;\n confirmNewPassword(password: string, requiredAttributes: any): Promise<void>;\n requestPasswordReset(username: string): Promise<void>;\n resendPasswordResetCode(): Promise<void>;\n confirmPasswordReset(code: string, password: string): Promise<void>;\n confirmTotpCode(code: string): Promise<void>;\n verifyTotpSetup(code: string): Promise<void>;\n\n // Navigation actions\n showSignIn(): void;\n showRequestPasswordResetCode(): void;\n showSetNewPassword(): void;\n}\n\nexport const CognitoPresenter = createAbstraction<ICognitoPresenter>(\"CognitoPresenter\");\n\nexport namespace CognitoPresenter {\n export type Interface = ICognitoPresenter;\n}\n"],"names":["CognitoPresenter","createAbstraction"],"mappings":";AA6HO,MAAMA,mBAAmBC,kBAAqC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ConfirmTotpCodeVM } from "../../../../admin/presentation/Cognito/abstractions.js";
|
|
3
|
+
export interface ConfirmTotpCodeProps {
|
|
4
|
+
vm: ConfirmTotpCodeVM;
|
|
5
|
+
onSubmit: (code: string) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ConfirmTotpCode: ((props: ConfirmTotpCodeProps) => React.JSX.Element) & {
|
|
9
|
+
original: (props: ConfirmTotpCodeProps) => React.JSX.Element;
|
|
10
|
+
originalName: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
} & {
|
|
13
|
+
original: ((props: ConfirmTotpCodeProps) => React.JSX.Element) & {
|
|
14
|
+
original: (props: ConfirmTotpCodeProps) => React.JSX.Element;
|
|
15
|
+
originalName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
originalName: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
} & {
|
|
21
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<((props: ConfirmTotpCodeProps) => React.JSX.Element) & {
|
|
22
|
+
original: (props: ConfirmTotpCodeProps) => React.JSX.Element;
|
|
23
|
+
originalName: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Alert, Button, Grid, Input } from "@webiny/admin-ui";
|
|
3
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
4
|
+
import { Bind, Form } from "@webiny/form";
|
|
5
|
+
import { validation } from "@webiny/validation";
|
|
6
|
+
import { View } from "./View.js";
|
|
7
|
+
import { FooterSignIn } from "./FooterSignIn.js";
|
|
8
|
+
const ConfirmTotpCode = makeDecoratable("CognitoConfirmTotpCode", (props)=>{
|
|
9
|
+
const { vm, onSubmit, onCancel } = props;
|
|
10
|
+
return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
|
|
11
|
+
onSubmit: (data)=>onSubmit(data.code),
|
|
12
|
+
submitOnEnter: true
|
|
13
|
+
}, ({ submit })=>/*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(View.Title, {
|
|
14
|
+
title: "Two-factor authentication",
|
|
15
|
+
description: "Enter the 6-digit code from your authenticator app."
|
|
16
|
+
}), vm.message && /*#__PURE__*/ react.createElement("div", {
|
|
17
|
+
className: "mb-lg"
|
|
18
|
+
}, /*#__PURE__*/ react.createElement(Alert, {
|
|
19
|
+
title: vm.message.title,
|
|
20
|
+
type: vm.message.type
|
|
21
|
+
}, vm.message.text)), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
22
|
+
span: 12
|
|
23
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
24
|
+
name: "code",
|
|
25
|
+
validators: validation.create("required")
|
|
26
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
27
|
+
label: "Verification Code",
|
|
28
|
+
autoComplete: "one-time-code",
|
|
29
|
+
inputMode: "numeric"
|
|
30
|
+
}))), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
31
|
+
span: 12
|
|
32
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
33
|
+
className: "flex items-center justify-between"
|
|
34
|
+
}, /*#__PURE__*/ react.createElement(FooterSignIn, {
|
|
35
|
+
onSignIn: onCancel
|
|
36
|
+
}), /*#__PURE__*/ react.createElement(Button, {
|
|
37
|
+
text: "Verify",
|
|
38
|
+
onClick: submit,
|
|
39
|
+
containerClassName: "ml-auto",
|
|
40
|
+
disabled: vm.isLoading
|
|
41
|
+
})))))));
|
|
42
|
+
});
|
|
43
|
+
export { ConfirmTotpCode };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=ConfirmTotpCode.js.map
|