@alore/auth-react-ui 1.0.0-alpha
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/LICENSE +504 -0
- package/dist/cjs/Auth.d.ts +18 -0
- package/dist/cjs/Auth.js +74 -0
- package/dist/cjs/Auth.js.map +1 -0
- package/dist/cjs/auth/Login.d.ts +15 -0
- package/dist/cjs/auth/Login.js +714 -0
- package/dist/cjs/auth/Login.js.map +1 -0
- package/dist/cjs/auth/Register.d.ts +16 -0
- package/dist/cjs/auth/Register.js +633 -0
- package/dist/cjs/auth/Register.js.map +1 -0
- package/dist/cjs/components/AuthProvider.d.ts +473 -0
- package/dist/cjs/components/AuthProvider.js +36 -0
- package/dist/cjs/components/AuthProvider.js.map +1 -0
- package/dist/cjs/components/BackButton.d.ts +9 -0
- package/dist/cjs/components/BackButton.js +28 -0
- package/dist/cjs/components/BackButton.js.map +1 -0
- package/dist/cjs/components/CheckboxForm.d.ts +12 -0
- package/dist/cjs/components/CheckboxForm.js +29 -0
- package/dist/cjs/components/CheckboxForm.js.map +1 -0
- package/dist/cjs/components/FormRules/helpers/index.d.ts +13 -0
- package/dist/cjs/components/FormRules/helpers/index.js +52 -0
- package/dist/cjs/components/FormRules/helpers/index.js.map +1 -0
- package/dist/cjs/components/FormRules/index.d.ts +11 -0
- package/dist/cjs/components/FormRules/index.js +19 -0
- package/dist/cjs/components/FormRules/index.js.map +1 -0
- package/dist/cjs/components/InputErrorHelperText.d.ts +7 -0
- package/dist/cjs/components/InputErrorHelperText.js +10 -0
- package/dist/cjs/components/InputErrorHelperText.js.map +1 -0
- package/dist/cjs/components/InputForm.d.ts +14 -0
- package/dist/cjs/components/InputForm.js +80 -0
- package/dist/cjs/components/InputForm.js.map +1 -0
- package/dist/cjs/components/InputOTP.d.ts +12 -0
- package/dist/cjs/components/InputOTP.js +118 -0
- package/dist/cjs/components/InputOTP.js.map +1 -0
- package/dist/cjs/components/TermsModal.d.ts +10 -0
- package/dist/cjs/components/TermsModal.js +27 -0
- package/dist/cjs/components/TermsModal.js.map +1 -0
- package/dist/cjs/components/index.d.ts +6 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/dictionaries/en.json +116 -0
- package/dist/cjs/dictionaries/pt.json +116 -0
- package/dist/cjs/get-dictionary.d.ts +356 -0
- package/dist/cjs/get-dictionary.js +46 -0
- package/dist/cjs/get-dictionary.js.map +1 -0
- package/dist/cjs/helpers/index.d.ts +8 -0
- package/dist/cjs/helpers/index.js +27 -0
- package/dist/cjs/helpers/index.js.map +1 -0
- package/dist/cjs/hooks/useAuthService.d.ts +1400 -0
- package/dist/cjs/hooks/useAuthService.js +15 -0
- package/dist/cjs/hooks/useAuthService.js.map +1 -0
- package/dist/cjs/hooks/useAuthServiceInstance.d.ts +469 -0
- package/dist/cjs/hooks/useAuthServiceInstance.js +13 -0
- package/dist/cjs/hooks/useAuthServiceInstance.js.map +1 -0
- package/dist/cjs/hooks/useDictionary.d.ts +118 -0
- package/dist/cjs/hooks/useDictionary.js +15 -0
- package/dist/cjs/hooks/useDictionary.js.map +1 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/machine/index.d.ts +937 -0
- package/dist/cjs/machine/index.js +1208 -0
- package/dist/cjs/machine/index.js.map +1 -0
- package/dist/cjs/machine/index.typegen.d.ts +164 -0
- package/dist/cjs/machine/index.typegen.js +4 -0
- package/dist/cjs/machine/index.typegen.js.map +1 -0
- package/dist/cjs/machine/types.d.ts +324 -0
- package/dist/cjs/machine/types.js +3 -0
- package/dist/cjs/machine/types.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +7 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/mjs/Auth.d.ts +18 -0
- package/dist/mjs/Auth.js +46 -0
- package/dist/mjs/Auth.js.map +1 -0
- package/dist/mjs/auth/Login.d.ts +15 -0
- package/dist/mjs/auth/Login.js +688 -0
- package/dist/mjs/auth/Login.js.map +1 -0
- package/dist/mjs/auth/Register.d.ts +16 -0
- package/dist/mjs/auth/Register.js +603 -0
- package/dist/mjs/auth/Register.js.map +1 -0
- package/dist/mjs/components/AuthProvider.d.ts +473 -0
- package/dist/mjs/components/AuthProvider.js +9 -0
- package/dist/mjs/components/AuthProvider.js.map +1 -0
- package/dist/mjs/components/BackButton.d.ts +9 -0
- package/dist/mjs/components/BackButton.js +9 -0
- package/dist/mjs/components/BackButton.js.map +1 -0
- package/dist/mjs/components/CheckboxForm.d.ts +12 -0
- package/dist/mjs/components/CheckboxForm.js +10 -0
- package/dist/mjs/components/CheckboxForm.js.map +1 -0
- package/dist/mjs/components/FormRules/helpers/index.d.ts +13 -0
- package/dist/mjs/components/FormRules/helpers/index.js +48 -0
- package/dist/mjs/components/FormRules/helpers/index.js.map +1 -0
- package/dist/mjs/components/FormRules/index.d.ts +11 -0
- package/dist/mjs/components/FormRules/index.js +14 -0
- package/dist/mjs/components/FormRules/index.js.map +1 -0
- package/dist/mjs/components/InputErrorHelperText.d.ts +7 -0
- package/dist/mjs/components/InputErrorHelperText.js +5 -0
- package/dist/mjs/components/InputErrorHelperText.js.map +1 -0
- package/dist/mjs/components/InputForm.d.ts +14 -0
- package/dist/mjs/components/InputForm.js +58 -0
- package/dist/mjs/components/InputForm.js.map +1 -0
- package/dist/mjs/components/InputOTP.d.ts +12 -0
- package/dist/mjs/components/InputOTP.js +93 -0
- package/dist/mjs/components/InputOTP.js.map +1 -0
- package/dist/mjs/components/TermsModal.d.ts +10 -0
- package/dist/mjs/components/TermsModal.js +21 -0
- package/dist/mjs/components/TermsModal.js.map +1 -0
- package/dist/mjs/components/index.d.ts +6 -0
- package/dist/mjs/components/index.js +7 -0
- package/dist/mjs/components/index.js.map +1 -0
- package/dist/mjs/dictionaries/en.json +116 -0
- package/dist/mjs/dictionaries/pt.json +116 -0
- package/dist/mjs/get-dictionary.d.ts +356 -0
- package/dist/mjs/get-dictionary.js +10 -0
- package/dist/mjs/get-dictionary.js.map +1 -0
- package/dist/mjs/helpers/index.d.ts +8 -0
- package/dist/mjs/helpers/index.js +23 -0
- package/dist/mjs/helpers/index.js.map +1 -0
- package/dist/mjs/hooks/useAuthService.d.ts +1400 -0
- package/dist/mjs/hooks/useAuthService.js +13 -0
- package/dist/mjs/hooks/useAuthService.js.map +1 -0
- package/dist/mjs/hooks/useAuthServiceInstance.d.ts +469 -0
- package/dist/mjs/hooks/useAuthServiceInstance.js +11 -0
- package/dist/mjs/hooks/useAuthServiceInstance.js.map +1 -0
- package/dist/mjs/hooks/useDictionary.d.ts +118 -0
- package/dist/mjs/hooks/useDictionary.js +13 -0
- package/dist/mjs/hooks/useDictionary.js.map +1 -0
- package/dist/mjs/index.d.ts +7 -0
- package/dist/mjs/index.js +6 -0
- package/dist/mjs/index.js.map +1 -0
- package/dist/mjs/machine/index.d.ts +937 -0
- package/dist/mjs/machine/index.js +1189 -0
- package/dist/mjs/machine/index.js.map +1 -0
- package/dist/mjs/machine/index.typegen.d.ts +164 -0
- package/dist/mjs/machine/index.typegen.js +3 -0
- package/dist/mjs/machine/index.typegen.js.map +1 -0
- package/dist/mjs/machine/types.d.ts +324 -0
- package/dist/mjs/machine/types.js +2 -0
- package/dist/mjs/machine/types.js.map +1 -0
- package/dist/mjs/utils/index.d.ts +7 -0
- package/dist/mjs/utils/index.js +16 -0
- package/dist/mjs/utils/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Login = void 0;
|
|
40
|
+
const solid_1 = require("@heroicons/react/20/solid");
|
|
41
|
+
const outline_1 = require("@heroicons/react/24/outline");
|
|
42
|
+
const yup_1 = require("@hookform/resolvers/yup");
|
|
43
|
+
const google_1 = require("@react-oauth/google");
|
|
44
|
+
const react_1 = require("@xstate/react");
|
|
45
|
+
const flowbite_react_1 = require("flowbite-react");
|
|
46
|
+
const react_2 = __importStar(require("react"));
|
|
47
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
48
|
+
const tailwind_merge_1 = require("tailwind-merge");
|
|
49
|
+
const yup = __importStar(require("yup"));
|
|
50
|
+
const helpers_1 = require("../helpers");
|
|
51
|
+
const useDictionary_1 = __importDefault(require("../hooks/useDictionary"));
|
|
52
|
+
const utils_1 = require("../utils");
|
|
53
|
+
const InputForm = react_2.default.lazy(() => Promise.resolve().then(() => __importStar(require('../components/InputForm'))));
|
|
54
|
+
const InputOTP = react_2.default.lazy(() => Promise.resolve().then(() => __importStar(require('../components/InputOTP'))));
|
|
55
|
+
const BackButton = react_2.default.lazy(() => Promise.resolve().then(() => __importStar(require('../components/BackButton'))));
|
|
56
|
+
const envelopIcon = () => react_2.default.createElement(solid_1.EnvelopeIcon, { className: "size-4 text-gray-500" });
|
|
57
|
+
const HARDWARE = 1;
|
|
58
|
+
const SOFTWARE = 2;
|
|
59
|
+
const ABORT_CONDITIONAL_UI = 'abort-conditional-ui';
|
|
60
|
+
const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshareWorker, cryptoUtils, }) => {
|
|
61
|
+
const { hashUserInfo, generateSecureHash } = cryptoUtils;
|
|
62
|
+
const dictionary = (0, useDictionary_1.default)(locale);
|
|
63
|
+
const loginDictionary = dictionary === null || dictionary === void 0 ? void 0 : dictionary.auth.login;
|
|
64
|
+
const [secureCode2FA, setSecure2FACode] = (0, react_2.useState)('');
|
|
65
|
+
const [secureCodeEmail, setSecureCodeEmail] = (0, react_2.useState)('');
|
|
66
|
+
const [authState, sendAuth] = (0, react_1.useActor)(authServiceInstance);
|
|
67
|
+
const { salt, error: authError, active2fa, registerUser, googleOtpCode, googleUser, sessionUser, RCRPublicKey, } = authState.context;
|
|
68
|
+
const [currentDevice, setCurrentDevice] = (0, react_2.useState)('');
|
|
69
|
+
const [loading, setLoading] = (0, react_2.useState)(false);
|
|
70
|
+
const [sendEmailCooldown, setSendEmailCooldown] = (0, react_2.useState)(0);
|
|
71
|
+
const [cooldownMultiplier, setCooldownMultiplier] = (0, react_2.useState)(1);
|
|
72
|
+
const [newDeviceInfo] = (0, react_2.useState)();
|
|
73
|
+
const [loginMethod, setLoginMethod] = (0, react_2.useState)('password');
|
|
74
|
+
const [isConditionalMediationAvailable, setIsConditionalMediationAvailable] = (0, react_2.useState)(false);
|
|
75
|
+
const [authAbortController, setAuthAbortController] = (0, react_2.useState)(undefined);
|
|
76
|
+
const intervalRef = (0, react_2.useRef)();
|
|
77
|
+
const googleLogin = (0, google_1.useGoogleLogin)({
|
|
78
|
+
onSuccess: (tokenResponse) => {
|
|
79
|
+
resetEmail();
|
|
80
|
+
sendAuth({
|
|
81
|
+
type: 'GOOGLE_LOGIN',
|
|
82
|
+
googleToken: tokenResponse.access_token,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
87
|
+
const handleGoogleLogin = () => googleLogin();
|
|
88
|
+
const hasPasskeySupportWithPRFOrLargeBlob = () => {
|
|
89
|
+
if (window.PublicKeyCredential &&
|
|
90
|
+
// eslint-disable-next-line no-undef
|
|
91
|
+
PublicKeyCredential.isConditionalMediationAvailable) {
|
|
92
|
+
Promise.all([
|
|
93
|
+
// eslint-disable-next-line no-undef
|
|
94
|
+
PublicKeyCredential.isConditionalMediationAvailable(),
|
|
95
|
+
]).then(([isConditionalMediationAvailableCheck]) => {
|
|
96
|
+
setIsConditionalMediationAvailable(isConditionalMediationAvailableCheck);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const selectLoginMethod = () => {
|
|
101
|
+
if (loginMethod === 'password') {
|
|
102
|
+
sendAuth('SELECT_PASSWORD');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const { username: email } = getValuesEmail();
|
|
106
|
+
sendAuth({
|
|
107
|
+
type: 'START_PASSKEY_LOGIN',
|
|
108
|
+
payload: {
|
|
109
|
+
email,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const cancelConditionalCredentialRequest = () => {
|
|
115
|
+
authAbortController === null || authAbortController === void 0 ? void 0 : authAbortController.abort(ABORT_CONDITIONAL_UI);
|
|
116
|
+
setAuthAbortController(undefined);
|
|
117
|
+
};
|
|
118
|
+
// eslint-disable-next-line no-undef
|
|
119
|
+
const sendSignedCredential = (credential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
121
|
+
const extensionResults = credential.getClientExtensionResults();
|
|
122
|
+
let secretFromCredential;
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
const hasPrf = !!((_b = (_a = extensionResults === null || extensionResults === void 0 ? void 0 : extensionResults.prf) === null || _a === void 0 ? void 0 : _a.results) === null || _b === void 0 ? void 0 : _b.first);
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
const hasLargeBlob = !!((_c = extensionResults === null || extensionResults === void 0 ? void 0 : extensionResults.largeBlob) === null || _c === void 0 ? void 0 : _c.blob);
|
|
127
|
+
if (hasPrf) {
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
secretFromCredential = (_e = (_d = extensionResults === null || extensionResults === void 0 ? void 0 : extensionResults.prf) === null || _d === void 0 ? void 0 : _d.results) === null || _e === void 0 ? void 0 : _e.first;
|
|
130
|
+
}
|
|
131
|
+
else if (hasLargeBlob) {
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
secretFromCredential = (_f = extensionResults === null || extensionResults === void 0 ? void 0 : extensionResults.largeBlob) === null || _f === void 0 ? void 0 : _f.blob;
|
|
134
|
+
}
|
|
135
|
+
if (hasLargeBlob && isSafari) {
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
secretFromCredential = (_g = extensionResults === null || extensionResults === void 0 ? void 0 : extensionResults.largeBlob) === null || _g === void 0 ? void 0 : _g.blob;
|
|
138
|
+
}
|
|
139
|
+
if (!secretFromCredential) {
|
|
140
|
+
sendAuth({
|
|
141
|
+
type: 'PASSKEY_NOT_SUPPORTED',
|
|
142
|
+
payload: { error: loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.passkeyNotSupported },
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
sendAuth({
|
|
147
|
+
type: 'FINISH_PASSKEY_LOGIN',
|
|
148
|
+
payload: {
|
|
149
|
+
passkeyAuth: {
|
|
150
|
+
id: credential.id,
|
|
151
|
+
rawId: Buffer.from(credential.rawId).toString('base64'),
|
|
152
|
+
response: {
|
|
153
|
+
authenticatorData: Buffer.from(
|
|
154
|
+
// eslint-disable-next-line no-undef
|
|
155
|
+
credential.response.authenticatorData).toString('base64'),
|
|
156
|
+
clientDataJSON: Buffer.from(credential.response.clientDataJSON).toString('base64'),
|
|
157
|
+
signature: Buffer.from(
|
|
158
|
+
// eslint-disable-next-line no-undef
|
|
159
|
+
credential.response.signature).toString('base64'),
|
|
160
|
+
userHandle: Buffer.from(
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
credential.response.userHandle || [0]).toString('base64'),
|
|
163
|
+
},
|
|
164
|
+
type: 'public-key',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
if (keyshareWorker) {
|
|
169
|
+
keyshareWorker.postMessage({
|
|
170
|
+
method: 'derive-password',
|
|
171
|
+
payload: {
|
|
172
|
+
password: new TextDecoder().decode(secretFromCredential),
|
|
173
|
+
email: credential.id,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const finishPasskeyAuth = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
|
+
var _h;
|
|
180
|
+
if (!RCRPublicKey || !(navigator === null || navigator === void 0 ? void 0 : navigator.credentials)) {
|
|
181
|
+
sendAuth('BACK');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
cancelConditionalCredentialRequest();
|
|
185
|
+
const { publicKey } = RCRPublicKey;
|
|
186
|
+
const extensions = {
|
|
187
|
+
prf: { eval: { first: new TextEncoder().encode('Alore') } },
|
|
188
|
+
largeBlob: {
|
|
189
|
+
read: true,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
// eslint-disable-next-line no-undef
|
|
193
|
+
const credentialOptions = {
|
|
194
|
+
publicKey: Object.assign(Object.assign({}, publicKey), {
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
196
|
+
allowCredentials: (_h = publicKey.allowCredentials) === null || _h === void 0 ? void 0 : _h.map((cred) => (Object.assign(Object.assign({}, cred), { id: Buffer.from(cred.id, 'base64') }))), timeout: 10000,
|
|
197
|
+
// @ts-ignore
|
|
198
|
+
challenge: Buffer.from(publicKey.challenge, 'base64'), rpId: publicKey.rpId, extensions: Object.assign(Object.assign({}, publicKey.extensions), extensions) }),
|
|
199
|
+
};
|
|
200
|
+
try {
|
|
201
|
+
if (authState.matches('active.login.signingCredentialRCR') ||
|
|
202
|
+
authState.matches('active.login.idle.signWithPasskey') ||
|
|
203
|
+
authState.matches('active.login.idle.authScreen')) {
|
|
204
|
+
const cred = yield navigator.credentials.get(credentialOptions);
|
|
205
|
+
// eslint-disable-next-line no-undef
|
|
206
|
+
const credential = cred;
|
|
207
|
+
sendSignedCredential(credential);
|
|
208
|
+
}
|
|
209
|
+
if (isConditionalMediationAvailable &&
|
|
210
|
+
authState.matches('active.login.idle.localPasskeySign')) {
|
|
211
|
+
const abortController = new AbortController();
|
|
212
|
+
setAuthAbortController(abortController);
|
|
213
|
+
const cred = yield navigator.credentials.get(Object.assign(Object.assign({}, credentialOptions), { mediation: 'conditional', signal: abortController.signal }));
|
|
214
|
+
// eslint-disable-next-line no-undef
|
|
215
|
+
const credential = cred;
|
|
216
|
+
sendSignedCredential(credential);
|
|
217
|
+
abortController === null || abortController === void 0 ? void 0 : abortController.abort();
|
|
218
|
+
setAuthAbortController(undefined);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (error !== ABORT_CONDITIONAL_UI) {
|
|
223
|
+
authAbortController === null || authAbortController === void 0 ? void 0 : authAbortController.abort();
|
|
224
|
+
setAuthAbortController(undefined);
|
|
225
|
+
sendAuth('BACK');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
(0, react_2.useEffect)(() => {
|
|
230
|
+
cancelConditionalCredentialRequest();
|
|
231
|
+
}, [authState.matches('active.login.loginMethodSelection')]);
|
|
232
|
+
(0, react_2.useEffect)(() => {
|
|
233
|
+
if (authState.matches('active.login.idle.localPasskeySign') ||
|
|
234
|
+
authState.matches('active.login.idle.signWithPasskey') ||
|
|
235
|
+
authState.matches('active.login.signingCredentialRCR')) {
|
|
236
|
+
finishPasskeyAuth();
|
|
237
|
+
}
|
|
238
|
+
}, [
|
|
239
|
+
authState.matches('active.login.idle.localPasskeySign'),
|
|
240
|
+
authState.matches('active.login.idle.signWithPasskey'),
|
|
241
|
+
authState.matches('active.login.signingCredentialRCR'),
|
|
242
|
+
]);
|
|
243
|
+
(0, react_2.useEffect)(() => {
|
|
244
|
+
if (authState.matches('active.login.idle.authScreen') && !isSafari) {
|
|
245
|
+
sendAuth('SET_CONDITIONAL_UI_PASSKEY');
|
|
246
|
+
}
|
|
247
|
+
}, [authState.matches('active.login.idle.authScreen')]);
|
|
248
|
+
const handlePasskeyButton = () => {
|
|
249
|
+
sendAuth('SIGN_IN_WITH_PASSKEY');
|
|
250
|
+
};
|
|
251
|
+
const isLoading = (0, react_2.useMemo)(() => loading ||
|
|
252
|
+
authState.matches('active.login.retrievingSalt') ||
|
|
253
|
+
authState.matches('active.login.verifyingLogin') ||
|
|
254
|
+
authState.matches('active.login.verifyingHwAuth') ||
|
|
255
|
+
authState.matches('active.login.verifying2faCode') ||
|
|
256
|
+
authState.matches('active.login.verifyingCode') ||
|
|
257
|
+
authState.matches('active.login.verifyingEmail2fa') ||
|
|
258
|
+
authState.matches('active.login.resendingEmailCode') ||
|
|
259
|
+
authState.matches('active.login.googleLogin') ||
|
|
260
|
+
authState.matches('active.login.verifyingGoogleLogin') ||
|
|
261
|
+
authState.matches('active.login.retrievingRCR') ||
|
|
262
|
+
authState.matches('active.login.verifyingRegisterPublicKeyCredential') ||
|
|
263
|
+
authState.matches('active.login.retrievingCredentialRCR') ||
|
|
264
|
+
authState.matches('active.login.signingCredentialRCR') ||
|
|
265
|
+
authState.matches('active.login.resendingConfirmationEmail') ||
|
|
266
|
+
authState.matches('active.web3Connector.verifyingClaimNftEmail2fa') ||
|
|
267
|
+
authState.matches('active.web3Connector.verifyingEmailEligibility'), [authState.value]);
|
|
268
|
+
(0, react_2.useEffect)(() => {
|
|
269
|
+
if (typeof window !== 'undefined') {
|
|
270
|
+
hasPasskeySupportWithPRFOrLargeBlob();
|
|
271
|
+
}
|
|
272
|
+
return () => {
|
|
273
|
+
cancelConditionalCredentialRequest();
|
|
274
|
+
};
|
|
275
|
+
}, []);
|
|
276
|
+
const emailFormSchema = yup
|
|
277
|
+
.object({
|
|
278
|
+
username: yup
|
|
279
|
+
.string()
|
|
280
|
+
.required(dictionary === null || dictionary === void 0 ? void 0 : dictionary.formValidation.required)
|
|
281
|
+
.email(dictionary === null || dictionary === void 0 ? void 0 : dictionary.formValidation.invalidEmail),
|
|
282
|
+
})
|
|
283
|
+
.required();
|
|
284
|
+
const passwordFormSchema = yup
|
|
285
|
+
.object({
|
|
286
|
+
password: yup
|
|
287
|
+
.string()
|
|
288
|
+
.required(dictionary === null || dictionary === void 0 ? void 0 : dictionary.formValidation.required)
|
|
289
|
+
.min(8, dictionary === null || dictionary === void 0 ? void 0 : dictionary.formValidation.passwordMinimum),
|
|
290
|
+
})
|
|
291
|
+
.required();
|
|
292
|
+
const activeHw2fa = (0, react_2.useMemo)(() => (active2fa === null || active2fa === void 0 ? void 0 : active2fa.filter((item) => item.twoFaTypeId === HARDWARE)) || [], [active2fa]);
|
|
293
|
+
const activeSw2fa = (0, react_2.useMemo)(() => active2fa === null || active2fa === void 0 ? void 0 : active2fa.find((item) => item.twoFaTypeId === SOFTWARE), [active2fa]);
|
|
294
|
+
const emailDefaultValues = {
|
|
295
|
+
username: '',
|
|
296
|
+
};
|
|
297
|
+
const { control: emailControl, formState: { errors: emailErrors, dirtyFields: emailDirtyFields }, handleSubmit: handleSubmitEmail, getValues: getValuesEmail, reset: resetEmail, } = (0, react_hook_form_1.useForm)({
|
|
298
|
+
resolver: (0, yup_1.yupResolver)(emailFormSchema),
|
|
299
|
+
defaultValues: emailDefaultValues,
|
|
300
|
+
});
|
|
301
|
+
(0, react_hook_form_1.useWatch)({ control: emailControl, name: ['username'] });
|
|
302
|
+
const passwordDefaultValues = {
|
|
303
|
+
password: '',
|
|
304
|
+
};
|
|
305
|
+
const { control: passwordControl, formState: { errors: passwordErrors, dirtyFields: passwordDirtyFields }, handleSubmit: handleSubmitPassword, getValues: getValuesPassword, } = (0, react_hook_form_1.useForm)({
|
|
306
|
+
resolver: (0, yup_1.yupResolver)(passwordFormSchema),
|
|
307
|
+
defaultValues: passwordDefaultValues,
|
|
308
|
+
});
|
|
309
|
+
(0, react_hook_form_1.useWatch)({ control: passwordControl, name: ['password'] });
|
|
310
|
+
(0, react_2.useEffect)(() => {
|
|
311
|
+
if (registerUser) {
|
|
312
|
+
if (forgeId) {
|
|
313
|
+
sendAuth(['RESET', { type: 'INITIALIZE', forgeId }]);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'LOGIN']);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}, [registerUser]);
|
|
320
|
+
(0, react_2.useEffect)(() => {
|
|
321
|
+
if (secureCode2FA.length === 6) {
|
|
322
|
+
if (authState.matches('active.login.email2fa')) {
|
|
323
|
+
onClickSecureCodeSubmit();
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
onSubmitSecureCode2FA();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}, [secureCode2FA]);
|
|
330
|
+
(0, react_2.useEffect)(() => {
|
|
331
|
+
if (secureCodeEmail.length === 6) {
|
|
332
|
+
onSubmitSecureCodeEmail();
|
|
333
|
+
}
|
|
334
|
+
}, [secureCodeEmail]);
|
|
335
|
+
(0, react_2.useEffect)(() => {
|
|
336
|
+
if (sendEmailCooldown <= 0) {
|
|
337
|
+
clearInterval(intervalRef.current);
|
|
338
|
+
}
|
|
339
|
+
}, [sendEmailCooldown]);
|
|
340
|
+
(0, react_2.useEffect)(() => {
|
|
341
|
+
var _a;
|
|
342
|
+
if (authState.matches('active.login.newDevice')) {
|
|
343
|
+
// getNewDeviceInfo(); // TODO
|
|
344
|
+
}
|
|
345
|
+
if (authState.matches('active.login.hardware2fa') &&
|
|
346
|
+
((_a = authState.history) === null || _a === void 0 ? void 0 : _a.matches('active.login.verifyingLogin'))) {
|
|
347
|
+
startHwAuth(0);
|
|
348
|
+
}
|
|
349
|
+
}, [authState.value]);
|
|
350
|
+
const startHwAuth = (index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
351
|
+
setLoading(true);
|
|
352
|
+
const { username: email } = getValuesEmail();
|
|
353
|
+
const { password } = getValuesPassword();
|
|
354
|
+
if (salt && active2fa) {
|
|
355
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
356
|
+
const hardwares2fa = active2fa.filter((item) => item.twoFaTypeId === HARDWARE);
|
|
357
|
+
sendAuth({
|
|
358
|
+
type: 'VERIFY_HW_AUTH',
|
|
359
|
+
payload: {
|
|
360
|
+
email,
|
|
361
|
+
device: currentDevice,
|
|
362
|
+
passwordHash: secureHashArgon2d,
|
|
363
|
+
authId: hardwares2fa[index].id,
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
setLoading(false);
|
|
368
|
+
});
|
|
369
|
+
const onSubmitEmail = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
370
|
+
setLoading(true);
|
|
371
|
+
const { username: email } = data;
|
|
372
|
+
// await signOut({ redirect: false });
|
|
373
|
+
sendAuth({ type: 'NEXT', payload: { email } });
|
|
374
|
+
setLoading(false);
|
|
375
|
+
});
|
|
376
|
+
const derivePasswordAndGetKeyshares = (password, email) => __awaiter(void 0, void 0, void 0, function* () {
|
|
377
|
+
if (keyshareWorker) {
|
|
378
|
+
keyshareWorker.postMessage({
|
|
379
|
+
method: 'derive-password',
|
|
380
|
+
payload: { password, email },
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
const onSubmitLogin = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
385
|
+
setLoading(true);
|
|
386
|
+
const { password } = data;
|
|
387
|
+
const email = getValuesEmail('username') || (googleUser === null || googleUser === void 0 ? void 0 : googleUser.email);
|
|
388
|
+
if (salt && email) {
|
|
389
|
+
derivePasswordAndGetKeyshares(password, email);
|
|
390
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
391
|
+
if (typeof window !== 'undefined') {
|
|
392
|
+
let device = window.localStorage.getItem('currentDeviceSecret');
|
|
393
|
+
if (!device) {
|
|
394
|
+
const { userAgent } = window.navigator;
|
|
395
|
+
device = hashUserInfo(userAgent);
|
|
396
|
+
}
|
|
397
|
+
setCurrentDevice(device);
|
|
398
|
+
if (googleOtpCode) {
|
|
399
|
+
sendAuth({
|
|
400
|
+
type: 'COMPLETE_GOOGLE_SIGN_IN',
|
|
401
|
+
payload: {
|
|
402
|
+
email,
|
|
403
|
+
passwordHash: secureHashArgon2d,
|
|
404
|
+
otp: googleOtpCode,
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
sendAuth({
|
|
410
|
+
type: 'VERIFY_LOGIN',
|
|
411
|
+
payload: {
|
|
412
|
+
email,
|
|
413
|
+
device,
|
|
414
|
+
passwordHash: secureHashArgon2d,
|
|
415
|
+
isForgeClaim: !!forgeId,
|
|
416
|
+
locale,
|
|
417
|
+
},
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
setLoading(false);
|
|
423
|
+
});
|
|
424
|
+
const onSubmitSecureCode2FA = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
425
|
+
setLoading(true);
|
|
426
|
+
const { username: email } = getValuesEmail();
|
|
427
|
+
const { password } = getValuesPassword();
|
|
428
|
+
if (salt) {
|
|
429
|
+
derivePasswordAndGetKeyshares(password, email);
|
|
430
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
431
|
+
sendAuth({
|
|
432
|
+
type: 'CONFIRM_SW_CODE',
|
|
433
|
+
payload: {
|
|
434
|
+
email,
|
|
435
|
+
device: currentDevice,
|
|
436
|
+
passwordHash: secureHashArgon2d,
|
|
437
|
+
otp: secureCode2FA,
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
setSecure2FACode('');
|
|
441
|
+
}
|
|
442
|
+
setLoading(false);
|
|
443
|
+
});
|
|
444
|
+
const onClickSecureCodeSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
445
|
+
setLoading(true);
|
|
446
|
+
const { password } = getValuesPassword();
|
|
447
|
+
const { username: email } = getValuesEmail();
|
|
448
|
+
if (salt) {
|
|
449
|
+
derivePasswordAndGetKeyshares(password, email);
|
|
450
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
451
|
+
if (typeof window !== 'undefined') {
|
|
452
|
+
let device = window.localStorage.getItem('currentDeviceSecret');
|
|
453
|
+
if (!device) {
|
|
454
|
+
const { userAgent } = window.navigator;
|
|
455
|
+
device = hashUserInfo(userAgent);
|
|
456
|
+
}
|
|
457
|
+
setCurrentDevice(device);
|
|
458
|
+
sendAuth({
|
|
459
|
+
type: 'VERIFY_EMAIL_2FA',
|
|
460
|
+
payload: {
|
|
461
|
+
email: getValuesEmail('username'),
|
|
462
|
+
secureCode: secureCode2FA,
|
|
463
|
+
passwordHash: secureHashArgon2d,
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
setLoading(false);
|
|
469
|
+
setSecure2FACode('');
|
|
470
|
+
});
|
|
471
|
+
const resendSecureCode = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
472
|
+
setLoading(true);
|
|
473
|
+
const { username: email } = getValuesEmail();
|
|
474
|
+
const { password } = getValuesPassword();
|
|
475
|
+
if (salt) {
|
|
476
|
+
derivePasswordAndGetKeyshares(password, email);
|
|
477
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
478
|
+
sendAuth({
|
|
479
|
+
type: 'RESEND_CODE',
|
|
480
|
+
payload: {
|
|
481
|
+
email,
|
|
482
|
+
passwordHash: secureHashArgon2d,
|
|
483
|
+
device: currentDevice,
|
|
484
|
+
nickname: email,
|
|
485
|
+
isForgeClaim: !!forgeId,
|
|
486
|
+
locale,
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
setSecureCodeEmail('');
|
|
490
|
+
}
|
|
491
|
+
setLoading(false);
|
|
492
|
+
setSendEmailCooldown(15 * cooldownMultiplier);
|
|
493
|
+
intervalRef.current = setInterval(() => setSendEmailCooldown((state) => state - 1), 1000);
|
|
494
|
+
setCooldownMultiplier((state) => state + 1);
|
|
495
|
+
});
|
|
496
|
+
const onSubmitSecureCodeEmail = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
497
|
+
setLoading(true);
|
|
498
|
+
const { username: email } = getValuesEmail();
|
|
499
|
+
const { password } = getValuesPassword();
|
|
500
|
+
if (salt) {
|
|
501
|
+
derivePasswordAndGetKeyshares(password, email);
|
|
502
|
+
const secureHashArgon2d = yield generateSecureHash(password, salt, 'argon2d');
|
|
503
|
+
sendAuth({
|
|
504
|
+
type: 'CONFIRM_DEVICE_CODE',
|
|
505
|
+
payload: {
|
|
506
|
+
email,
|
|
507
|
+
passwordHash: secureHashArgon2d,
|
|
508
|
+
device: currentDevice,
|
|
509
|
+
secureCode: secureCodeEmail,
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
setSecureCodeEmail('');
|
|
513
|
+
}
|
|
514
|
+
setLoading(false);
|
|
515
|
+
});
|
|
516
|
+
const isLoginSubmitDisabled = (0, react_2.useMemo)(() => (0, helpers_1.verifyEmptyValues)(Object.assign(Object.assign({}, getValuesEmail()), getValuesPassword())), [
|
|
517
|
+
Object.assign(Object.assign({}, getValuesEmail()), getValuesPassword()),
|
|
518
|
+
Object.assign(Object.assign({}, emailDirtyFields), passwordDirtyFields),
|
|
519
|
+
]);
|
|
520
|
+
const getAuthError = () => {
|
|
521
|
+
let authErrorTitle = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.somethingWrong;
|
|
522
|
+
let authErrorDescription = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.defaultError;
|
|
523
|
+
if (authError === null || authError === void 0 ? void 0 : authError.includes('Invalid credentials')) {
|
|
524
|
+
authErrorTitle = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.invalidEmailPassword;
|
|
525
|
+
authErrorDescription = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.invalidEmailPasswordDescription;
|
|
526
|
+
}
|
|
527
|
+
else if (authError === null || authError === void 0 ? void 0 : authError.includes('Passkey')) {
|
|
528
|
+
authErrorTitle = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.passkeyNotSupported;
|
|
529
|
+
authErrorDescription = loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.passkeyNotSupportedDescription;
|
|
530
|
+
}
|
|
531
|
+
return { authErrorTitle, authErrorDescription };
|
|
532
|
+
};
|
|
533
|
+
const EmailInputStep = (0, react_2.useMemo)(() => {
|
|
534
|
+
const { authErrorTitle, authErrorDescription } = getAuthError();
|
|
535
|
+
return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
536
|
+
authError ? (react_2.default.createElement("div", { className: "flex flex-col items-center justify-center gap-5" },
|
|
537
|
+
react_2.default.createElement("img", { src: utils_1.authErrorImage, alt: "alore logo", width: 70 }),
|
|
538
|
+
(authError === null || authError === void 0 ? void 0 : authError.includes('beta')) ? (react_2.default.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authError)) : (react_2.default.createElement(react_2.default.Fragment, null,
|
|
539
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authErrorTitle),
|
|
540
|
+
react_2.default.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription))))) : (react_2.default.createElement("h1", { className: "font-inter text-center text-lg font-bold text-gray-700" }, forgeId ? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.forgeLogin : loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.loginAccount)),
|
|
541
|
+
react_2.default.createElement("form", { className: "flex flex-col gap-y-5", onSubmit: handleSubmitEmail((data) => onSubmitEmail(data)) },
|
|
542
|
+
react_2.default.createElement(InputForm, { className: "my-1", control: emailControl, errors: emailErrors, name: "username", type: "text", placeholder: loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.enterEmail, "data-test": "login-email", icon: envelopIcon, autoComplete: authAbortController && isConditionalMediationAvailable
|
|
543
|
+
? 'username webauthn'
|
|
544
|
+
: undefined, autoFocus: true }),
|
|
545
|
+
react_2.default.createElement(flowbite_react_1.Button, { type: "submit", "data-test": "login-button", disabled: (0, helpers_1.verifyEmptyValues)(getValuesEmail('username')), className: "bg-alr-red hover:bg-alr-dark-red group relative flex items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600" },
|
|
546
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }), loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
547
|
+
loginDictionary.login),
|
|
548
|
+
react_2.default.createElement("div", { className: "h-[0.5px] w-full bg-gray-300" }),
|
|
549
|
+
typeof window.PublicKeyCredential !== 'undefined' && (react_2.default.createElement(flowbite_react_1.Button, { color: "light", onClick: handlePasskeyButton, outline: true }, dictionary === null || dictionary === void 0 ? void 0 : dictionary.auth.signWithPasskey)),
|
|
550
|
+
react_2.default.createElement(flowbite_react_1.Button, { color: "light", onClick: handleGoogleLogin, outline: true },
|
|
551
|
+
react_2.default.createElement("div", { className: "flex flex-row items-center justify-center gap-2" },
|
|
552
|
+
react_2.default.createElement("img", { src: utils_1.google, alt: "google logo", width: 16 }), dictionary === null || dictionary === void 0 ? void 0 :
|
|
553
|
+
dictionary.auth.continueGoogle)),
|
|
554
|
+
forgeId && (react_2.default.createElement(flowbite_react_1.Button, { color: "light", onClick: () => sendAuth('LOGIN_WITH_WEB3CONNECTOR'), outline: true },
|
|
555
|
+
react_2.default.createElement("div", { className: "flex flex-row items-center justify-center gap-2" },
|
|
556
|
+
react_2.default.createElement("div", { className: "relative flex flex-row" },
|
|
557
|
+
react_2.default.createElement("img", { src: utils_1.metamaskLogo, alt: "metamask logo", width: 20, className: "absolute right-3" }),
|
|
558
|
+
react_2.default.createElement("img", { src: utils_1.walletConnectLogo, alt: "walletconnect logo", width: 20 })),
|
|
559
|
+
"Metamask/WalletConnect"))),
|
|
560
|
+
react_2.default.createElement("span", { className: "text-center text-sm font-medium" }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
561
|
+
loginDictionary.dontHaveAccount,
|
|
562
|
+
react_2.default.createElement("div", { className: "text-alr-red cursor-pointer", onClick: () => {
|
|
563
|
+
sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'SIGN_UP']);
|
|
564
|
+
} }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.signUp)))));
|
|
565
|
+
}, [getValuesEmail(), isLoginSubmitDisabled, emailErrors, emailControl, isLoading]);
|
|
566
|
+
const SelectLoginMethod = (0, react_2.useMemo)(() => {
|
|
567
|
+
const { authErrorTitle, authErrorDescription } = getAuthError();
|
|
568
|
+
return (react_2.default.createElement("div", null,
|
|
569
|
+
react_2.default.createElement(BackButton, { disabled: isLoading, onClick: () => sendAuth('BACK') }),
|
|
570
|
+
authError ? (react_2.default.createElement("div", { className: "my-4 flex flex-col items-center justify-center gap-2" },
|
|
571
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authErrorTitle),
|
|
572
|
+
react_2.default.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription))) : undefined,
|
|
573
|
+
react_2.default.createElement("div", { className: "mt-2 flex w-full flex-col items-center", "data-test": "login-method-selection-step" },
|
|
574
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }),
|
|
575
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey mb-6 text-center text-2xl font-bold md:text-[1.75rem]" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.selectMethodTitle),
|
|
576
|
+
react_2.default.createElement("span", { className: "text-alr-grey mb-6 w-full text-center font-medium" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.selectMethodDescription),
|
|
577
|
+
react_2.default.createElement("div", { className: "flex flex-col gap-5" },
|
|
578
|
+
react_2.default.createElement("div", { className: "flex w-full gap-2" },
|
|
579
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "login-method-selection-password", onClick: () => setLoginMethod('password'), color: "light", className: `${loginMethod === 'password' ? '!border-alr-red' : '!border-gray-500'} child:h-full w-full cursor-pointer items-start border focus:ring-0` },
|
|
580
|
+
react_2.default.createElement("div", { className: "flex flex-col items-start justify-center gap-2" },
|
|
581
|
+
react_2.default.createElement(outline_1.LockOpenIcon, { className: `${loginMethod === 'password' ? 'text-alr-red' : 'text-gray-500'} size-7` }),
|
|
582
|
+
react_2.default.createElement("span", { className: "font-semibold text-gray-900" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.password),
|
|
583
|
+
react_2.default.createElement("span", { className: "text-start text-xs font-normal text-gray-600" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.selectMethodPassword))),
|
|
584
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "login-method-selection-passkey", onClick: () => setLoginMethod('passkey'), color: "light", className: `${loginMethod === 'passkey' ? '!border-alr-red' : '!border-gray-500'} child:h-full w-full cursor-pointer items-start border focus:ring-0` },
|
|
585
|
+
react_2.default.createElement("div", { className: "flex flex-col items-start justify-center gap-2" },
|
|
586
|
+
react_2.default.createElement(outline_1.KeyIcon, { className: `${loginMethod === 'passkey' ? 'text-alr-red' : 'text-gray-500'} size-7` }),
|
|
587
|
+
react_2.default.createElement("span", { className: "font-semibold text-gray-900" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.passkey),
|
|
588
|
+
react_2.default.createElement("span", { className: "text-start text-xs font-normal text-gray-600" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.selectMethodPasskey)))),
|
|
589
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "login-method-selection-submit", onClick: () => selectLoginMethod(), className: "bg-alr-red text-alr-white mb-6 flex w-full cursor-pointer items-center" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.continue)))));
|
|
590
|
+
}, [isLoading, loginMethod]);
|
|
591
|
+
const PasswordInputStep = (0, react_2.useMemo)(() => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
592
|
+
react_2.default.createElement(BackButton, { className: "mb-2.5", onClick: () => sendAuth('BACK') }, getValuesEmail('username') || (googleUser === null || googleUser === void 0 ? void 0 : googleUser.email)),
|
|
593
|
+
authError && (react_2.default.createElement("div", { className: "flex flex-col items-center justify-center gap-5" },
|
|
594
|
+
react_2.default.createElement("img", { src: utils_1.authErrorImage, alt: "alore logo", width: 70 }),
|
|
595
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, (authError === null || authError === void 0 ? void 0 : authError.includes('Invalid credentials'))
|
|
596
|
+
? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.invalidEmailPassword
|
|
597
|
+
: loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.somethingWrong),
|
|
598
|
+
react_2.default.createElement("span", { className: "text-alr-grey text-center font-medium" }, (authError === null || authError === void 0 ? void 0 : authError.includes('Invalid credentials'))
|
|
599
|
+
? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.invalidEmailPasswordDescription
|
|
600
|
+
: loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.defaultError))),
|
|
601
|
+
react_2.default.createElement("form", { onSubmit: handleSubmitPassword((data) => onSubmitLogin(data)), className: "flex flex-col gap-y-5", "data-test": "login-password-step" },
|
|
602
|
+
react_2.default.createElement(InputForm, { control: passwordControl, errors: passwordErrors, name: "password", placeholder: loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.enterPassword, type: "password", label: dictionary === null || dictionary === void 0 ? void 0 : dictionary.password, "data-test": "login-password" }),
|
|
603
|
+
react_2.default.createElement(flowbite_react_1.Button, { type: "submit", "data-test": "login-submit", disabled: (0, helpers_1.verifyEmptyValues)(getValuesPassword('password')), className: "bg-alr-red hover:bg-alr-dark-red group relative flex items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600" },
|
|
604
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }), loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
605
|
+
loginDictionary.login),
|
|
606
|
+
react_2.default.createElement("span", { className: "text-sm font-medium" }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
607
|
+
loginDictionary.dontHaveAccount,
|
|
608
|
+
react_2.default.createElement("div", { className: "text-alr-red cursor-pointer", onClick: () => {
|
|
609
|
+
sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'SIGN_UP']);
|
|
610
|
+
} }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.signUp))))), [getValuesPassword(), isLoginSubmitDisabled, passwordErrors, passwordControl, isLoading]);
|
|
611
|
+
const VerifyEmail = (0, react_2.useMemo)(() => (react_2.default.createElement("div", { className: "pb-10 pt-4" },
|
|
612
|
+
react_2.default.createElement(BackButton, { disabled: isLoading, onClick: () => sendAuth('BACK') }),
|
|
613
|
+
react_2.default.createElement("div", { className: "flex w-full flex-col items-center", "data-test": "login-verify-email-step" },
|
|
614
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey mb-10 mt-[4.5rem] text-[1.75rem] font-bold" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.verifyEmail),
|
|
615
|
+
react_2.default.createElement("span", { className: "text-alr-grey mb-12 w-[23.75rem] text-center font-medium" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.verifyEmailDescription),
|
|
616
|
+
react_2.default.createElement("div", { className: "mb-6 flex" },
|
|
617
|
+
react_2.default.createElement(InputOTP, { className: "child:gap-x-3 md:child:gap-x-5 [&>div>input]:!h-9 [&>div>input]:!w-9", value: secureCode2FA, onChange: (value) => setSecure2FACode(value), inputLength: 6, "data-test": "secure-code", errorMessage: (authError === null || authError === void 0 ? void 0 : authError.includes('wrong')) ? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.wrongCode : undefined, disabled: isLoading })),
|
|
618
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "secure-code-submit", onClick: () => onClickSecureCodeSubmit(), className: "bg-alr-red hover:bg-alr-dark-red group relative mb-6 flex w-full items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600", disabled: secureCode2FA.length !== 6 || isLoading },
|
|
619
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }), loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
620
|
+
loginDictionary.confirmCode),
|
|
621
|
+
react_2.default.createElement("span", { onClick: () => resendSecureCode(), className: (0, tailwind_merge_1.twMerge)(`text-base font-medium duration-300`, sendEmailCooldown > 0
|
|
622
|
+
? 'pointer-events-none opacity-50'
|
|
623
|
+
: 'hover:text-alr-red cursor-pointer opacity-100') }, `${loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.resendCode}${sendEmailCooldown ? ` (${sendEmailCooldown}s)` : ''}`)))), [secureCode2FA, sendEmailCooldown, isLoading, authState]);
|
|
624
|
+
const VerifyHw2FAStep = (0, react_2.useMemo)(() => (react_2.default.createElement("div", null,
|
|
625
|
+
react_2.default.createElement(BackButton, { onClick: () => sendAuth('BACK') }),
|
|
626
|
+
(authError === null || authError === void 0 ? void 0 : authError.includes('Failed authenticating with hardware key')) ? (react_2.default.createElement("div", { className: "mt-6 flex w-full flex-col items-center gap-6" },
|
|
627
|
+
react_2.default.createElement("img", { alt: "fingerprint error", src: utils_1.fingerprintError }),
|
|
628
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-red text-center text-[1.3rem] font-bold" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.cantVerify2fa),
|
|
629
|
+
react_2.default.createElement(flowbite_react_1.Button, { className: "bg-alr-red hover:bg-alr-dark-red group relative flex w-full items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600", onClick: () => startHwAuth(0) }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.tryAgain),
|
|
630
|
+
(activeHw2fa === null || activeHw2fa === void 0 ? void 0 : activeHw2fa.length) > 1 && (react_2.default.createElement(react_2.default.Fragment, null,
|
|
631
|
+
react_2.default.createElement("span", null, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.tryHardware),
|
|
632
|
+
react_2.default.createElement("div", { className: "text-alr-red flex cursor-pointer items-center gap-x-1 text-base font-semibold", onClick: () => startHwAuth(1) }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
633
|
+
loginDictionary.useAnotherHardware,
|
|
634
|
+
react_2.default.createElement(solid_1.ArrowRightIcon, { className: "size-5" })))),
|
|
635
|
+
activeSw2fa && (react_2.default.createElement("div", { className: "text-alr-red flex cursor-pointer items-center gap-x-1 text-base font-semibold", onClick: () => sendAuth('USE_SOFTWARE_2FA') }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
636
|
+
loginDictionary.useSw2fa,
|
|
637
|
+
react_2.default.createElement(solid_1.ArrowRightIcon, { className: "size-5" }))))) : (react_2.default.createElement("div", { className: "flex w-full flex-col items-center" },
|
|
638
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey mb-10 mt-12 text-center text-[1.3rem] font-bold" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.touchHardware),
|
|
639
|
+
react_2.default.createElement("span", { className: "text-alr-grey mb-10 w-60 text-sm font-normal" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.touchHardwareDescription),
|
|
640
|
+
react_2.default.createElement("img", { alt: "usb indicator", src: utils_1.fingerprint }),
|
|
641
|
+
activeSw2fa && (react_2.default.createElement("div", { className: "text-alr-red mt-9 flex cursor-pointer items-center gap-x-1 text-base font-semibold", onClick: () => sendAuth('USE_SOFTWARE_2FA') }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
642
|
+
loginDictionary.useSw2fa,
|
|
643
|
+
react_2.default.createElement(solid_1.ArrowRightIcon, { className: "size-5" }))))))), [isLoading, active2fa]);
|
|
644
|
+
const VerifySw2FAStep = (0, react_2.useMemo)(() => (react_2.default.createElement("div", null,
|
|
645
|
+
react_2.default.createElement(BackButton, { onClick: () => sendAuth('BACK') }),
|
|
646
|
+
react_2.default.createElement("div", { className: "flex w-full flex-col items-center" },
|
|
647
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey mb-10 mt-12 text-center text-[1.3rem] font-bold" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.inform2FACode),
|
|
648
|
+
react_2.default.createElement("div", { className: "mb-6 flex" },
|
|
649
|
+
react_2.default.createElement(InputOTP, { className: "child:gap-x-3 md:child:gap-x-5 [&>div>input]:!h-9 [&>div>input]:!w-9", value: secureCode2FA, onChange: (value) => setSecure2FACode(value), "data-test": "secure-code-2FA", inputLength: 6, errorMessage: (authError === null || authError === void 0 ? void 0 : authError.includes('Invalid 2FA code')) ? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.wrongCode : undefined })),
|
|
650
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "secure-code-2FA-submit", onClick: () => onSubmitSecureCode2FA(), className: "bg-alr-red hover:bg-alr-dark-red group relative mb-6 flex w-full items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600", disabled: secureCode2FA.length !== 6 },
|
|
651
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }), loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
652
|
+
loginDictionary.confirmCode),
|
|
653
|
+
(active2fa === null || active2fa === void 0 ? void 0 : active2fa.find((item) => item.twoFaTypeId === HARDWARE)) && (react_2.default.createElement("div", { className: "text-alr-red mt-9 flex cursor-pointer items-center gap-x-1 text-base font-semibold", onClick: () => sendAuth('USE_HARDWARE_2FA') }, loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
654
|
+
loginDictionary.useHw2fa,
|
|
655
|
+
react_2.default.createElement(solid_1.ArrowRightIcon, { className: "size-5" })))))), [secureCode2FA, isLoading, active2fa]);
|
|
656
|
+
const NewDeviceStep = (0, react_2.useMemo)(() => (react_2.default.createElement("div", null,
|
|
657
|
+
react_2.default.createElement("div", { className: "flex w-full flex-col items-center" },
|
|
658
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey mb-5 mt-14 text-[1.75rem] font-bold" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.newDevice),
|
|
659
|
+
react_2.default.createElement("span", { className: "text-alr-grey mb-3 w-[23.75rem] text-center font-medium" }, loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.verifyEmailDescription),
|
|
660
|
+
react_2.default.createElement("span", { className: "mb-5 font-bold" }, getValuesEmail('username')),
|
|
661
|
+
react_2.default.createElement("div", { className: "mb-5 h-44 w-full" }),
|
|
662
|
+
react_2.default.createElement("div", { className: "mb-6 flex" },
|
|
663
|
+
react_2.default.createElement(InputOTP, { className: "child:gap-x-3 md:child:gap-x-5 [&>div>input]:!h-9 [&>div>input]:!w-9", value: secureCodeEmail, onChange: (value) => setSecureCodeEmail(value), "data-test": "secure-code-email", inputLength: 6, errorMessage: (authError === null || authError === void 0 ? void 0 : authError.includes('Wrong code')) ? loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.wrongCode : undefined })),
|
|
664
|
+
react_2.default.createElement(flowbite_react_1.Button, { "data-test": "secure-code-email-submit", onClick: () => onSubmitSecureCodeEmail(), className: "bg-alr-red hover:bg-alr-dark-red group relative mb-6 flex w-full items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600", disabled: secureCodeEmail.length !== 6 },
|
|
665
|
+
isLoading && react_2.default.createElement(flowbite_react_1.Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }), loginDictionary === null || loginDictionary === void 0 ? void 0 :
|
|
666
|
+
loginDictionary.confirmCode),
|
|
667
|
+
react_2.default.createElement("span", { onClick: () => resendSecureCode(), className: (0, tailwind_merge_1.twMerge)(`text-base font-medium duration-300`, sendEmailCooldown > 0
|
|
668
|
+
? 'pointer-events-none opacity-50'
|
|
669
|
+
: 'hover:text-alr-red cursor-pointer opacity-100') }, `${loginDictionary === null || loginDictionary === void 0 ? void 0 : loginDictionary.resendCode}${sendEmailCooldown ? ` (${sendEmailCooldown}s)` : ''}`)))), [secureCodeEmail, sendEmailCooldown, isLoading, newDeviceInfo]);
|
|
670
|
+
return (react_2.default.createElement("div", { className: "flex size-full min-h-screen flex-col items-center justify-center gap-y-2 sm:gap-y-7", "data-test": "login-page" },
|
|
671
|
+
forgeId ? (react_2.default.createElement("div", { className: "flex flex-col" },
|
|
672
|
+
react_2.default.createElement("span", { className: "font-poppins text-alr-grey text-center text-2xl font-black" }, "Tardezinha com Thiaguinho"),
|
|
673
|
+
react_2.default.createElement("div", { className: "flex w-full flex-row items-center justify-center gap-2" },
|
|
674
|
+
react_2.default.createElement("span", { className: "font-inter text-sm font-medium text-gray-900" }, dictionary === null || dictionary === void 0 ? void 0 : dictionary.auth.poweredBy),
|
|
675
|
+
react_2.default.createElement("img", { src: utils_1.aloreLogoBlack, alt: "alore logo", width: "60" })))) : (logoImage || (react_2.default.createElement("img", { src: utils_1.aloreLogoBlack, alt: "alore logo", width: authState.matches('active.login.newDevice') ? 153 : 201 }))),
|
|
676
|
+
react_2.default.createElement(flowbite_react_1.Card, { className: (0, tailwind_merge_1.twMerge)(`md:child:!px-9 mx-5 flex min-w-[20rem] py-2 md:mx-7 md:w-96`, isLoading ? 'pointer-events-none opacity-50' : '') },
|
|
677
|
+
forgeId && authState.matches('active.web3Connector') && 'TODO',
|
|
678
|
+
(authState.matches('active.login.passkeyGuard') ||
|
|
679
|
+
authState.matches('active.login.idle') ||
|
|
680
|
+
authState.matches('active.login.googleLogin') ||
|
|
681
|
+
authState.matches('active.login.retrievingSalt') ||
|
|
682
|
+
authState.matches('active.login.verifyingRegisterPublicKeyCredential') ||
|
|
683
|
+
authState.matches('active.login.retrievingRCR')) &&
|
|
684
|
+
EmailInputStep,
|
|
685
|
+
(authState.matches('active.login.loginMethodSelection') ||
|
|
686
|
+
authState.matches('active.login.signingCredentialRCR') ||
|
|
687
|
+
authState.matches('active.login.retrievingCredentialRCR')) &&
|
|
688
|
+
SelectLoginMethod,
|
|
689
|
+
(authState.matches('active.login.inputPassword') ||
|
|
690
|
+
authState.matches('active.login.verifyingGoogleLogin') ||
|
|
691
|
+
authState.matches('active.login.verifyingLogin')) &&
|
|
692
|
+
PasswordInputStep,
|
|
693
|
+
(authState.matches('active.login.email2fa') ||
|
|
694
|
+
authState.matches('active.login.resendingEmailCode') ||
|
|
695
|
+
authState.matches('active.login.verifyingEmail2fa')) &&
|
|
696
|
+
VerifyEmail,
|
|
697
|
+
(authState.matches('active.login.hardware2fa') ||
|
|
698
|
+
authState.matches('active.login.verifyingHwAuth')) &&
|
|
699
|
+
VerifyHw2FAStep,
|
|
700
|
+
(authState.matches('active.login.software2fa') ||
|
|
701
|
+
authState.matches('active.login.verifying2faCode')) &&
|
|
702
|
+
VerifySw2FAStep,
|
|
703
|
+
(authState.matches('active.login.newDevice') ||
|
|
704
|
+
authState.matches('active.login.verifyingCode') ||
|
|
705
|
+
authState.matches('active.login.resendingConfirmationEmail')) &&
|
|
706
|
+
NewDeviceStep,
|
|
707
|
+
authState.matches('active.login.successfulLogin') && (react_2.default.createElement("div", { className: "flex flex-col items-center justify-center gap-4" },
|
|
708
|
+
react_2.default.createElement("div", { className: "flex flex-row items-center justify-center gap-2" },
|
|
709
|
+
react_2.default.createElement("span", null, "Login complete for"),
|
|
710
|
+
react_2.default.createElement("span", { className: "font-semibold" }, sessionUser === null || sessionUser === void 0 ? void 0 : sessionUser.nickname)),
|
|
711
|
+
react_2.default.createElement(flowbite_react_1.Button, { className: "bg-alr-red hover:bg-alr-dark-red group relative flex items-center justify-center rounded-lg border border-transparent p-0.5 text-center font-medium text-white duration-300 focus:z-10 focus:outline-none focus:ring-2 focus:ring-red-300 enabled:hover:bg-red-700 disabled:hover:bg-red-900 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:enabled:hover:bg-red-700 dark:disabled:hover:bg-red-600", onClick: () => sendAuth(['RESET_CONTEXT', 'INITIALIZE']) }, "LOGOUT"))))));
|
|
712
|
+
};
|
|
713
|
+
exports.Login = Login;
|
|
714
|
+
//# sourceMappingURL=Login.js.map
|