@webiny/cognito 6.4.4-beta.2 → 6.4.4-beta.4
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 +51 -0
- package/Cognito.js +75 -4
- package/Cognito.js.map +1 -1
- package/admin/DefaultCognitoSignInConfig.d.ts +23 -0
- package/admin/DefaultCognitoSignInConfig.js +51 -0
- package/admin/DefaultCognitoSignInConfig.js.map +1 -0
- package/admin/Extension.js +3 -0
- package/admin/Extension.js.map +1 -1
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js +9 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +25 -1
- package/admin/presentation/Cognito/CognitoPresenter.js +122 -10
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
- 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 +20 -1
- package/admin/presentation/Cognito/abstractions.js.map +1 -1
- 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 +19 -1
- package/admin/presentation/Cognito/components/Divider.js +3 -2
- package/admin/presentation/Cognito/components/Divider.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +22 -5
- package/admin/presentation/Cognito/components/FederatedLogin.js +19 -6
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +20 -3
- package/admin/presentation/Cognito/components/FooterSignIn.js +3 -2
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +19 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +3 -2
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +3 -2
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.js +3 -2
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/SetNewPassword.js +3 -2
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
- 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 +19 -3
- package/admin/presentation/Cognito/components/SignIn.js +14 -7
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
- 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/signInFeature.d.ts +1 -0
- package/admin/presentation/Cognito/signInFeature.js +11 -0
- package/admin/presentation/Cognito/signInFeature.js.map +1 -0
- package/admin/ui/views/Users/UsersForm.js +21 -15
- package/admin/ui/views/Users/UsersForm.js.map +1 -1
- package/admin/ui/views/Users/hooks/useUserForm.js +3 -1
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +15 -11
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
- package/api/features/CognitoIdp/abstractions.d.ts +1 -1
- package/api/features/CognitoIdp/abstractions.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/infra/CognitoFederationPulumi.d.ts +8 -0
- package/infra/CognitoFederationPulumi.js +17 -0
- package/infra/CognitoFederationPulumi.js.map +1 -0
- package/package.json +19 -17
|
@@ -1 +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\";\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 constructor(\n private identity: IdentityContext.Interface,\n private logInUseCase: LogInUseCase.Interface\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 },\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 };\n }\n\n async init(params: ICognitoInitParams): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n Amplify.configure({\n Auth: {\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 {\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 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 const query = new URLSearchParams(window.location.search);\n const queryData: Record<string, string> = {};\n query.forEach((value, key) => (queryData[key] = value));\n const { state } = queryData;\n\n if (state) {\n // Handle state from URL if needed\n return;\n }\n\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]\n});\n"],"names":["CognitoPresenterImpl","identity","logInUseCase","makeAutoObservable","params","Amplify","username","password","runInAction","usernameOrPassword","result","signIn","nextStep","error","message","requiredAttributes","confirmSignIn","resetPassword","code","confirmResetPassword","session","fetchAuthSession","idToken","Error","signOut","console","query","URLSearchParams","window","queryData","value","key","state","CognitoPresenter","CognitoPresenterAbstraction","IdentityContext","LogInUseCase"],"mappings":";;;;;;AAoBA,MAAMA;IASF,YACYC,QAAmC,EACnCC,YAAoC,CAC9C;aAFUD,QAAQ,GAARA;aACAC,YAAY,GAAZA;aAVJ,SAAS,GAAc;aACvB,QAAQ,GAAoB;aAC5B,OAAO,GAAuB;aAC9B,eAAe,GAAG;aAClB,WAAW,GAAG;aACd,WAAW,GAAG;aACd,WAAW,GAAG;QAMlBC,mBAAmB,IAAI;IAC3B;IAEA,IAAI,KAAK;QACL,MAAMF,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,WA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AAM,IAAIC,MAAM;oBAEpB,OAAOD,QAAQ,QAAQ;gBAC3B;gBACA,gBAAgB;oBACZE;oBACAhB,YAAY;wBACR,IAAI,CAAC,SAAS,GAAG;wBACjB,IAAI,CAAC,QAAQ,GAAG;oBACpB;gBACJ;YACJ;YAEAA,YAAY;gBACR,IAAI,CAAC,SAAS,GAAG;YACrB;QACJ,EAAE,OAAOK,OAAO;YACZY,QAAQ,KAAK,CAAC,yBAAyBZ;YACvCL,YAAY;gBACR,IAAI,CAAC,SAAS,GAAG;YACrB;QACJ,SAAU;YACNA,YAAY;gBACR,IAAI,CAAC,WAAW,GAAG;YACvB;QACJ;IACJ;IAEA,MAAc,WAA0B;QACpC,MAAMkB,QAAQ,IAAIC,gBAAgBC,OAAO,QAAQ,CAAC,MAAM;QACxD,MAAMC,YAAoC,CAAC;QAC3CH,MAAM,OAAO,CAAC,CAACI,OAAOC,MAASF,SAAS,CAACE,IAAI,GAAGD;QAChD,MAAM,EAAEE,KAAK,EAAE,GAAGH;QAElB,IAAIG,OAEA;QAGJ,OAAO,IAAI,CAAC,YAAY;IAC5B;IAEA,MAAc,eAA8B;QACxCxB,YAAY;YACR,IAAI,CAAC,eAAe,GAAG;QAC3B;QAEA,IAAI;YACA,MAAMY,UAAU,MAAMC;YACtB,IAAID,QAAQ,MAAM,EAEd,IAAI,CAAC,cAAc;QAE3B,EAAE,OAAM,CAER,SAAU;YACNZ,YAAY;gBACR,IAAI,CAAC,eAAe,GAAG;YAC3B;QACJ;IACJ;AACJ;AAEO,MAAMyB,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBlC;IAChB,cAAc;QAACmC;QAAiBC;KAAa;AACjD"}
|
|
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,G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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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IFederatedProvider } from "./CognitoSignInConfig.js";
|
|
2
|
+
export type AuthState = "signIn" | "signedIn" | "signedOut" | "requestPasswordResetCode" | "passwordResetCodeSent" | "setNewPassword" | "requireNewPassword" | "confirmTotpCode" | "setupTotp";
|
|
2
3
|
export interface AuthDataVerified {
|
|
3
4
|
email?: string;
|
|
4
5
|
phone_number?: string;
|
|
@@ -27,6 +28,10 @@ export interface ICognitoInitParams {
|
|
|
27
28
|
export interface SignInVM {
|
|
28
29
|
isLoading: boolean;
|
|
29
30
|
message: AuthMessage | null;
|
|
31
|
+
title: string;
|
|
32
|
+
description: string | undefined;
|
|
33
|
+
allowCredentialsLogin: boolean;
|
|
34
|
+
federatedProviders: IFederatedProvider[];
|
|
30
35
|
}
|
|
31
36
|
export interface RequireNewPasswordVM {
|
|
32
37
|
isLoading: boolean;
|
|
@@ -44,6 +49,16 @@ export interface SetNewPasswordVM {
|
|
|
44
49
|
isLoading: boolean;
|
|
45
50
|
message: AuthMessage | null;
|
|
46
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
|
+
}
|
|
47
62
|
export interface ICognitoPresenter {
|
|
48
63
|
vm: {
|
|
49
64
|
authState: AuthState;
|
|
@@ -55,6 +70,8 @@ export interface ICognitoPresenter {
|
|
|
55
70
|
requestPasswordResetCode: RequestPasswordResetCodeVM;
|
|
56
71
|
passwordResetCodeSent: PasswordResetCodeSentVM;
|
|
57
72
|
setNewPassword: SetNewPasswordVM;
|
|
73
|
+
confirmTotpCode: ConfirmTotpCodeVM;
|
|
74
|
+
setupTotp: SetupTotpVM;
|
|
58
75
|
};
|
|
59
76
|
init(params: ICognitoInitParams): Promise<void>;
|
|
60
77
|
signIn(username: string, password: string): Promise<void>;
|
|
@@ -62,6 +79,8 @@ export interface ICognitoPresenter {
|
|
|
62
79
|
requestPasswordReset(username: string): Promise<void>;
|
|
63
80
|
resendPasswordResetCode(): Promise<void>;
|
|
64
81
|
confirmPasswordReset(code: string, password: string): Promise<void>;
|
|
82
|
+
confirmTotpCode(code: string): Promise<void>;
|
|
83
|
+
verifyTotpSetup(code: string): Promise<void>;
|
|
65
84
|
showSignIn(): void;
|
|
66
85
|
showRequestPasswordResetCode(): void;
|
|
67
86
|
showSetNewPassword(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/Cognito/abstractions.js","sources":["../../../../src/admin/presentation/Cognito/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport type AuthState =\n | \"signIn\"\n | \"signedIn\"\n | \"signedOut\"\n | \"requestPasswordResetCode\"\n | \"passwordResetCodeSent\"\n | \"setNewPassword\"\n | \"requireNewPassword\";\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}\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 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 };\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\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":";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/ConfirmTotpCode.js","sources":["../../../../../src/admin/presentation/Cognito/components/ConfirmTotpCode.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { ConfirmTotpCodeVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface ConfirmTotpCodeProps {\n vm: ConfirmTotpCodeVM;\n onSubmit: (code: string) => void;\n onCancel: () => void;\n}\n\nexport const ConfirmTotpCode = makeDecoratable(\n \"CognitoConfirmTotpCode\",\n (props: ConfirmTotpCodeProps) => {\n const { vm, onSubmit, onCancel } = props;\n\n return (\n <View.Container>\n <Form<{ code: string }> onSubmit={data => onSubmit(data.code)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Two-factor authentication\"}\n description={\"Enter the 6-digit code from your authenticator app.\"}\n />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n autoComplete={\"one-time-code\"}\n inputMode={\"numeric\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex items-center justify-between\"}>\n <FooterSignIn onSignIn={onCancel} />\n <Button\n text={\"Verify\"}\n onClick={submit}\n containerClassName={\"ml-auto\"}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n }\n);\n"],"names":["ConfirmTotpCode","makeDecoratable","props","vm","onSubmit","onCancel","View","Form","data","submit","Alert","Grid","Bind","validation","Input","FooterSignIn","Button"],"mappings":";;;;;;;AAeO,MAAMA,kBAAkBC,gBAC3B,0BACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGH;IAEnC,OAAO,WAAP,GACI,oBAACI,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAmB,UAAUC,CAAAA,OAAQJ,SAASI,KAAK,IAAI;QAAG;OAC1D,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YACP,OAAO;YACP,aAAa;YAGhBH,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACO,OAAKA;YAAC,OAAOP,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACQ,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,cAAc;YACd,WAAW;4BAIvB,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACI,cAAYA;YAAC,UAAUV;0BACxB,oBAACW,QAAMA;YACH,MAAM;YACN,SAASP;YACT,oBAAoB;YACpB,UAAUN,GAAG,SAAS;;AAU9D"}
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Divider: () => React.JSX.Element
|
|
2
|
+
export declare const Divider: (() => React.JSX.Element) & {
|
|
3
|
+
original: () => React.JSX.Element;
|
|
4
|
+
originalName: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
} & {
|
|
7
|
+
original: (() => React.JSX.Element) & {
|
|
8
|
+
original: () => React.JSX.Element;
|
|
9
|
+
originalName: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
originalName: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
} & {
|
|
15
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(() => React.JSX.Element) & {
|
|
16
|
+
original: () => React.JSX.Element;
|
|
17
|
+
originalName: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
20
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { Separator, Text } from "@webiny/admin-ui";
|
|
3
|
-
|
|
3
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
4
|
+
const Divider = makeDecoratable("CognitoDivider", ()=>/*#__PURE__*/ react.createElement("div", {
|
|
4
5
|
className: "relative my-lg"
|
|
5
6
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
6
7
|
className: "absolute inset-0 flex items-center"
|
|
@@ -9,7 +10,7 @@ const Divider = ()=>/*#__PURE__*/ react.createElement("div", {
|
|
|
9
10
|
}, /*#__PURE__*/ react.createElement(Text, {
|
|
10
11
|
size: "sm",
|
|
11
12
|
className: "text-neutral-strong px-sm bg-neutral-base uppercase"
|
|
12
|
-
}, "Or continue with")));
|
|
13
|
+
}, "Or continue with"))));
|
|
13
14
|
export { Divider };
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=Divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/Cognito/components/Divider.js","sources":["../../../../../src/admin/presentation/Cognito/components/Divider.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Text } from \"@webiny/admin-ui\";\n\nexport const Divider = () => {\n return (\n <div className={\"relative my-lg\"}>\n <div className={\"absolute inset-0 flex items-center\"}>\n <Separator />\n </div>\n <div className={\"relative flex justify-center\"}>\n <Text size={\"sm\"} className={\"text-neutral-strong px-sm bg-neutral-base uppercase\"}>\n {\"Or continue with\"}\n </Text>\n </div>\n </div>\n );\n};\n"],"names":["Divider","Separator","Text"],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/Divider.js","sources":["../../../../../src/admin/presentation/Cognito/components/Divider.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Text } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\n\nexport const Divider = makeDecoratable(\"CognitoDivider\", () => {\n return (\n <div className={\"relative my-lg\"}>\n <div className={\"absolute inset-0 flex items-center\"}>\n <Separator />\n </div>\n <div className={\"relative flex justify-center\"}>\n <Text size={\"sm\"} className={\"text-neutral-strong px-sm bg-neutral-base uppercase\"}>\n {\"Or continue with\"}\n </Text>\n </div>\n </div>\n );\n});\n"],"names":["Divider","makeDecoratable","Separator","Text"],"mappings":";;;AAIO,MAAMA,UAAUC,gBAAgB,kBAAkB,IAC9C,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;qBACZ,oBAACC,WAASA,QAAAA,WAAAA,GAEd,oBAAC;QAAI,WAAW;qBACZ,oBAACC,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxB"}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
interface FederatedLoginProps {
|
|
4
|
-
providers:
|
|
2
|
+
import { CognitoSignInConfig } from "../../../../admin/index.js";
|
|
3
|
+
export interface FederatedLoginProps {
|
|
4
|
+
providers: CognitoSignInConfig.FederatedProvider[];
|
|
5
5
|
}
|
|
6
|
-
export declare const FederatedLogin: ({ providers }: FederatedLoginProps) => React.JSX.Element
|
|
7
|
-
|
|
6
|
+
export declare const FederatedLogin: (({ providers }: FederatedLoginProps) => React.JSX.Element) & {
|
|
7
|
+
original: ({ providers }: FederatedLoginProps) => React.JSX.Element;
|
|
8
|
+
originalName: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
} & {
|
|
11
|
+
original: (({ providers }: FederatedLoginProps) => React.JSX.Element) & {
|
|
12
|
+
original: ({ providers }: FederatedLoginProps) => React.JSX.Element;
|
|
13
|
+
originalName: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
originalName: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
} & {
|
|
19
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ providers }: FederatedLoginProps) => React.JSX.Element) & {
|
|
20
|
+
original: ({ providers }: FederatedLoginProps) => React.JSX.Element;
|
|
21
|
+
originalName: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
24
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { signInWithRedirect } from "aws-amplify/auth";
|
|
3
|
+
import { Button } from "@webiny/admin-ui";
|
|
4
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
3
5
|
import { federatedIdentityProviders } from "../../../federatedIdentityProviders.js";
|
|
4
6
|
import { FederatedProviders } from "./FederatedProviders.js";
|
|
5
7
|
const builtInProviders = new Set([
|
|
@@ -8,8 +10,8 @@ const builtInProviders = new Set([
|
|
|
8
10
|
"Facebook",
|
|
9
11
|
"Google"
|
|
10
12
|
]);
|
|
11
|
-
const FederatedLogin = ({ providers })=>/*#__PURE__*/ react.createElement(FederatedProviders.Container, null, providers.map((
|
|
12
|
-
const cognitoProviderName = federatedIdentityProviders[name] ?? name;
|
|
13
|
+
const FederatedLogin = makeDecoratable("CognitoFederatedLogin", ({ providers })=>/*#__PURE__*/ react.createElement(FederatedProviders.Container, null, providers.map((provider)=>{
|
|
14
|
+
const cognitoProviderName = federatedIdentityProviders[provider.name] ?? provider.name;
|
|
13
15
|
const isBuiltIn = builtInProviders.has(cognitoProviderName);
|
|
14
16
|
const signIn = ()=>{
|
|
15
17
|
isBuiltIn ? signInWithRedirect({
|
|
@@ -20,11 +22,22 @@ const FederatedLogin = ({ providers })=>/*#__PURE__*/ react.createElement(Federa
|
|
|
20
22
|
}
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
if ("component" in provider) {
|
|
26
|
+
const Component = provider.component;
|
|
27
|
+
return /*#__PURE__*/ react.createElement(Component, {
|
|
28
|
+
key: provider.name,
|
|
29
|
+
signIn: signIn
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
33
|
+
key: provider.name,
|
|
34
|
+
text: provider.label,
|
|
35
|
+
onClick: signIn,
|
|
36
|
+
style: {
|
|
37
|
+
width: "100%"
|
|
38
|
+
}
|
|
26
39
|
});
|
|
27
|
-
}));
|
|
40
|
+
})));
|
|
28
41
|
export { FederatedLogin };
|
|
29
42
|
|
|
30
43
|
//# sourceMappingURL=FederatedLogin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/Cognito/components/FederatedLogin.js","sources":["../../../../../src/admin/presentation/Cognito/components/FederatedLogin.tsx"],"sourcesContent":["import React from \"react\";\nimport { signInWithRedirect } from \"aws-amplify/auth\";\nimport
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/FederatedLogin.js","sources":["../../../../../src/admin/presentation/Cognito/components/FederatedLogin.tsx"],"sourcesContent":["import React from \"react\";\nimport { signInWithRedirect } from \"aws-amplify/auth\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { federatedIdentityProviders } from \"~/admin/federatedIdentityProviders.js\";\nimport { FederatedProviders } from \"./FederatedProviders.js\";\nimport { CognitoSignInConfig } from \"~/admin/index.js\";\n\ntype AuthProvider = \"Amazon\" | \"Apple\" | \"Facebook\" | \"Google\";\n\nconst builtInProviders = new Set<string>([\"Amazon\", \"Apple\", \"Facebook\", \"Google\"]);\n\nexport interface FederatedLoginProps {\n providers: CognitoSignInConfig.FederatedProvider[];\n}\n\nexport const FederatedLogin = makeDecoratable(\n \"CognitoFederatedLogin\",\n ({ providers }: FederatedLoginProps) => {\n return (\n <FederatedProviders.Container>\n {providers.map(provider => {\n const cognitoProviderName =\n federatedIdentityProviders[provider.name] ?? provider.name;\n const isBuiltIn = builtInProviders.has(cognitoProviderName);\n\n const signIn = () => {\n if (isBuiltIn) {\n signInWithRedirect({\n provider: cognitoProviderName as AuthProvider\n });\n } else {\n signInWithRedirect({\n provider: { custom: cognitoProviderName }\n });\n }\n };\n\n if (\"component\" in provider) {\n const Component = provider.component;\n return <Component key={provider.name} signIn={signIn} />;\n }\n\n return (\n <Button\n key={provider.name}\n text={provider.label}\n onClick={signIn}\n style={{ width: \"100%\" }}\n />\n );\n })}\n </FederatedProviders.Container>\n );\n }\n);\n"],"names":["builtInProviders","Set","FederatedLogin","makeDecoratable","providers","FederatedProviders","provider","cognitoProviderName","federatedIdentityProviders","isBuiltIn","signIn","signInWithRedirect","Component","Button"],"mappings":";;;;;;AAUA,MAAMA,mBAAmB,IAAIC,IAAY;IAAC;IAAU;IAAS;IAAY;CAAS;AAM3E,MAAMC,iBAAiBC,gBAC1B,yBACA,CAAC,EAAEC,SAAS,EAAuB,GACxB,WAAP,GACI,oBAACC,mBAAmB,SAAS,QACxBD,UAAU,GAAG,CAACE,CAAAA;QACX,MAAMC,sBACFC,0BAA0B,CAACF,SAAS,IAAI,CAAC,IAAIA,SAAS,IAAI;QAC9D,MAAMG,YAAYT,iBAAiB,GAAG,CAACO;QAEvC,MAAMG,SAAS;YACPD,YACAE,mBAAmB;gBACf,UAAUJ;YACd,KAEAI,mBAAmB;gBACf,UAAU;oBAAE,QAAQJ;gBAAoB;YAC5C;QAER;QAEA,IAAI,eAAeD,UAAU;YACzB,MAAMM,YAAYN,SAAS,SAAS;YACpC,OAAO,WAAP,GAAO,oBAACM,WAAAA;gBAAU,KAAKN,SAAS,IAAI;gBAAE,QAAQI;;QAClD;QAEA,OAAO,WAAP,GACI,oBAACG,QAAMA;YACH,KAAKP,SAAS,IAAI;YAClB,MAAMA,SAAS,KAAK;YACpB,SAASI;YACT,OAAO;gBAAE,OAAO;YAAO;;IAGnC"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface FooterSignInProps {
|
|
2
|
+
export interface FooterSignInProps {
|
|
3
3
|
onSignIn: () => void;
|
|
4
4
|
}
|
|
5
|
-
export declare const FooterSignIn: ({ onSignIn }: FooterSignInProps) => React.JSX.Element
|
|
6
|
-
|
|
5
|
+
export declare const FooterSignIn: (({ onSignIn }: FooterSignInProps) => React.JSX.Element) & {
|
|
6
|
+
original: ({ onSignIn }: FooterSignInProps) => React.JSX.Element;
|
|
7
|
+
originalName: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
} & {
|
|
10
|
+
original: (({ onSignIn }: FooterSignInProps) => React.JSX.Element) & {
|
|
11
|
+
original: ({ onSignIn }: FooterSignInProps) => React.JSX.Element;
|
|
12
|
+
originalName: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
originalName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
} & {
|
|
18
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ onSignIn }: FooterSignInProps) => React.JSX.Element) & {
|
|
19
|
+
original: ({ onSignIn }: FooterSignInProps) => React.JSX.Element;
|
|
20
|
+
originalName: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
23
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { Link, Text } from "@webiny/admin-ui";
|
|
3
|
-
|
|
3
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
4
|
+
const FooterSignIn = makeDecoratable("CognitoFooterSignIn", ({ onSignIn })=>/*#__PURE__*/ react.createElement(Text, {
|
|
4
5
|
as: "div",
|
|
5
6
|
size: "sm"
|
|
6
7
|
}, "Want to sign in?\xa0", /*#__PURE__*/ react.createElement(Link, {
|
|
7
8
|
to: "#",
|
|
8
9
|
onClick: onSignIn
|
|
9
|
-
}, "Sign in"), ".");
|
|
10
|
+
}, "Sign in"), "."));
|
|
10
11
|
export { FooterSignIn };
|
|
11
12
|
|
|
12
13
|
//# sourceMappingURL=FooterSignIn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/Cognito/components/FooterSignIn.js","sources":["../../../../../src/admin/presentation/Cognito/components/FooterSignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Link, Text } from \"@webiny/admin-ui\";\n\
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/FooterSignIn.js","sources":["../../../../../src/admin/presentation/Cognito/components/FooterSignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Link, Text } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\n\nexport interface FooterSignInProps {\n onSignIn: () => void;\n}\n\nexport const FooterSignIn = makeDecoratable(\n \"CognitoFooterSignIn\",\n ({ onSignIn }: FooterSignInProps) => {\n return (\n <Text as={\"div\"} size={\"sm\"}>\n Want to sign in? \n <Link to=\"#\" onClick={onSignIn}>\n Sign in\n </Link>\n .\n </Text>\n );\n }\n);\n"],"names":["FooterSignIn","makeDecoratable","onSignIn","Text","Link"],"mappings":";;;AAQO,MAAMA,eAAeC,gBACxB,uBACA,CAAC,EAAEC,QAAQ,EAAqB,GACrB,WAAP,GACI,oBAACC,MAAIA;QAAC,IAAI;QAAO,MAAM;OAAM,sCAEzB,oBAACC,MAAIA;QAAC,IAAG;QAAI,SAASF;OAAU,YAEzB"}
|
|
@@ -6,4 +6,22 @@ export interface PasswordResetCodeSentProps {
|
|
|
6
6
|
onCodeAcquired: () => void;
|
|
7
7
|
onCancel: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const PasswordResetCodeSent: (props: PasswordResetCodeSentProps) => React.JSX.Element
|
|
9
|
+
export declare const PasswordResetCodeSent: ((props: PasswordResetCodeSentProps) => React.JSX.Element) & {
|
|
10
|
+
original: (props: PasswordResetCodeSentProps) => React.JSX.Element;
|
|
11
|
+
originalName: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
} & {
|
|
14
|
+
original: ((props: PasswordResetCodeSentProps) => React.JSX.Element) & {
|
|
15
|
+
original: (props: PasswordResetCodeSentProps) => React.JSX.Element;
|
|
16
|
+
originalName: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
originalName: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
} & {
|
|
22
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<((props: PasswordResetCodeSentProps) => React.JSX.Element) & {
|
|
23
|
+
original: (props: PasswordResetCodeSentProps) => React.JSX.Element;
|
|
24
|
+
originalName: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
27
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { Alert, Button, Grid, Text } from "@webiny/admin-ui";
|
|
3
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
3
4
|
import { View } from "./View.js";
|
|
4
5
|
import { FooterSignIn } from "./FooterSignIn.js";
|
|
5
|
-
const PasswordResetCodeSent = (props)=>{
|
|
6
|
+
const PasswordResetCodeSent = makeDecoratable("CognitoPasswordResetCodeSent", (props)=>{
|
|
6
7
|
const { vm, onResendCode, onCodeAcquired, onCancel } = props;
|
|
7
8
|
return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(View.Title, {
|
|
8
9
|
title: "Password recovery",
|
|
@@ -33,7 +34,7 @@ const PasswordResetCodeSent = (props)=>{
|
|
|
33
34
|
text: "I got the code!",
|
|
34
35
|
onClick: onCodeAcquired
|
|
35
36
|
})))))));
|
|
36
|
-
};
|
|
37
|
+
});
|
|
37
38
|
export { PasswordResetCodeSent };
|
|
38
39
|
|
|
39
40
|
//# sourceMappingURL=PasswordResetCodeSent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/Cognito/components/PasswordResetCodeSent.js","sources":["../../../../../src/admin/presentation/Cognito/components/PasswordResetCodeSent.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert, Button, Grid, Text } from \"@webiny/admin-ui\";\nimport { View } from \"./View.js\";\nimport type { PasswordResetCodeSentVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface PasswordResetCodeSentProps {\n vm: PasswordResetCodeSentVM;\n onResendCode: () => void;\n onCodeAcquired: () => void;\n onCancel: () => void;\n}\n\nexport const PasswordResetCodeSent = (props: PasswordResetCodeSentProps) => {\n
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/PasswordResetCodeSent.js","sources":["../../../../../src/admin/presentation/Cognito/components/PasswordResetCodeSent.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert, Button, Grid, Text } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport { View } from \"./View.js\";\nimport type { PasswordResetCodeSentVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface PasswordResetCodeSentProps {\n vm: PasswordResetCodeSentVM;\n onResendCode: () => void;\n onCodeAcquired: () => void;\n onCancel: () => void;\n}\n\nexport const PasswordResetCodeSent = makeDecoratable(\n \"CognitoPasswordResetCodeSent\",\n (props: PasswordResetCodeSentProps) => {\n const { vm, onResendCode, onCodeAcquired, onCancel } = props;\n\n return (\n <View.Container>\n <View.Content>\n <View.Title\n title={\"Password recovery\"}\n description={\"Request a password reset code.\"}\n />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Text>We have sent you a code to reset your password.</Text>\n </Grid.Column>\n <Grid.Column span={12}>\n <Text>\n Click the "Resend code" button below to resend the code in\n case you haven't received it the first time.\n </Text>\n </Grid.Column>\n\n <Grid.Column span={12}>\n <div className={\"flex items-center justify-between\"}>\n <FooterSignIn onSignIn={onCancel} />\n <div className={\"flex gap-x-sm\"}>\n <Button\n variant={\"secondary\"}\n text={\"Resend code\"}\n onClick={onResendCode}\n />\n <Button\n variant={\"primary\"}\n text={\"I got the code!\"}\n onClick={onCodeAcquired}\n />\n </div>\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n </View.Container>\n );\n }\n);\n"],"names":["PasswordResetCodeSent","makeDecoratable","props","vm","onResendCode","onCodeAcquired","onCancel","View","Alert","Grid","Text","FooterSignIn","Button"],"mappings":";;;;;AAcO,MAAMA,wBAAwBC,gBACjC,gCACA,CAACC;IACG,MAAM,EAAEC,EAAE,EAAEC,YAAY,EAAEC,cAAc,EAAEC,QAAQ,EAAE,GAAGJ;IAEvD,OAAO,WAAP,GACI,oBAACK,KAAK,SAAS,sBACX,oBAACA,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;QACP,OAAO;QACP,aAAa;QAGhBJ,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;QAAI,WAAW;qBACZ,oBAACK,OAAKA;QAAC,OAAOL,GAAG,OAAO,CAAC,KAAK;QAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;OAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACM,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA,MAAC,mEAEV,oBAACD,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA,MAAC,4HAMV,oBAACD,KAAK,MAAM;QAAC,MAAM;qBACf,oBAAC;QAAI,WAAW;qBACZ,oBAACE,cAAYA;QAAC,UAAUL;sBACxB,oBAAC;QAAI,WAAW;qBACZ,oBAACM,QAAMA;QACH,SAAS;QACT,MAAM;QACN,SAASR;sBAEb,oBAACQ,QAAMA;QACH,SAAS;QACT,MAAM;QACN,SAASP;;AAS7C"}
|
|
@@ -5,4 +5,22 @@ export interface ForgotPasswordProps {
|
|
|
5
5
|
onRequestCode: (username: string) => void;
|
|
6
6
|
onCancel: () => void;
|
|
7
7
|
}
|
|
8
|
-
export declare const RequestPasswordResetCode: (props: ForgotPasswordProps) => React.JSX.Element
|
|
8
|
+
export declare const RequestPasswordResetCode: ((props: ForgotPasswordProps) => React.JSX.Element) & {
|
|
9
|
+
original: (props: ForgotPasswordProps) => React.JSX.Element;
|
|
10
|
+
originalName: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
} & {
|
|
13
|
+
original: ((props: ForgotPasswordProps) => React.JSX.Element) & {
|
|
14
|
+
original: (props: ForgotPasswordProps) => 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: ForgotPasswordProps) => React.JSX.Element) & {
|
|
22
|
+
original: (props: ForgotPasswordProps) => React.JSX.Element;
|
|
23
|
+
originalName: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
26
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { Alert, Button, Grid, Input } from "@webiny/admin-ui";
|
|
3
|
+
import { makeDecoratable } from "@webiny/app-admin";
|
|
3
4
|
import { Bind, Form } from "@webiny/form";
|
|
4
5
|
import { validation } from "@webiny/validation";
|
|
5
6
|
import { View } from "./View.js";
|
|
6
7
|
import { FooterSignIn } from "./FooterSignIn.js";
|
|
7
|
-
const RequestPasswordResetCode = (props)=>{
|
|
8
|
+
const RequestPasswordResetCode = makeDecoratable("CognitoRequestPasswordResetCode", (props)=>{
|
|
8
9
|
const { vm, ...actions } = props;
|
|
9
10
|
return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
|
|
10
11
|
onSubmit: (data)=>actions.onRequestCode(data.username),
|
|
@@ -35,7 +36,7 @@ const RequestPasswordResetCode = (props)=>{
|
|
|
35
36
|
}), /*#__PURE__*/ react.createElement(FooterSignIn, {
|
|
36
37
|
onSignIn: actions.onCancel
|
|
37
38
|
})))))));
|
|
38
|
-
};
|
|
39
|
+
});
|
|
39
40
|
export { RequestPasswordResetCode };
|
|
40
41
|
|
|
41
42
|
//# sourceMappingURL=RequestPasswordResetCode.js.map
|