@aws-amplify/ui-angular 2.0.4 → 2.0.8
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/aws-amplify-ui-angular.metadata.json +1 -1
- package/bundles/aws-amplify-ui-angular.umd.js +22 -12
- package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
- package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +10 -4
- package/esm2015/lib/components/authenticator/components/sign-in/sign-in.component.js +7 -4
- package/fesm2015/aws-amplify-ui-angular.js +14 -5
- package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
- package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +3 -0
- package/package.json +3 -3
- package/theme.css +12 -0
|
@@ -1190,6 +1190,8 @@
|
|
|
1190
1190
|
this.dataAttr = '';
|
|
1191
1191
|
this.headerText = ui.translate('Setup TOTP');
|
|
1192
1192
|
this.qrCodeSource = '';
|
|
1193
|
+
this.secretKey = '';
|
|
1194
|
+
this.copyTextLabel = ui.translate('COPY');
|
|
1193
1195
|
// translated texts
|
|
1194
1196
|
this.backToSignInText = ui.translate('Back to Sign In');
|
|
1195
1197
|
this.confirmText = ui.translate('Confirm');
|
|
@@ -1206,29 +1208,30 @@
|
|
|
1206
1208
|
});
|
|
1207
1209
|
SetupTotpComponent.prototype.generateQRCode = function () {
|
|
1208
1210
|
return __awaiter(this, void 0, void 0, function () {
|
|
1209
|
-
var state, actorContext, user,
|
|
1210
|
-
return __generator(this, function (
|
|
1211
|
-
switch (
|
|
1211
|
+
var state, actorContext, user, _a, issuer, totpCode, _b, err_1;
|
|
1212
|
+
return __generator(this, function (_c) {
|
|
1213
|
+
switch (_c.label) {
|
|
1212
1214
|
case 0:
|
|
1213
1215
|
state = this.authenticator.authState;
|
|
1214
1216
|
actorContext = ui.getActorContext(state);
|
|
1215
1217
|
user = actorContext.user;
|
|
1216
|
-
|
|
1218
|
+
_c.label = 1;
|
|
1217
1219
|
case 1:
|
|
1218
|
-
|
|
1220
|
+
_c.trys.push([1, 4, , 5]);
|
|
1221
|
+
_a = this;
|
|
1219
1222
|
return [4 /*yield*/, awsAmplify.Auth.setupTOTP(user)];
|
|
1220
1223
|
case 2:
|
|
1221
|
-
secretKey =
|
|
1224
|
+
_a.secretKey = _c.sent();
|
|
1222
1225
|
issuer = 'AWSCognito';
|
|
1223
|
-
totpCode = "otpauth://totp/" + issuer + ":" + user.username + "?secret=" + secretKey + "&issuer=" + issuer;
|
|
1226
|
+
totpCode = "otpauth://totp/" + issuer + ":" + user.username + "?secret=" + this.secretKey + "&issuer=" + issuer;
|
|
1224
1227
|
logger.info('totp code was generated:', totpCode);
|
|
1225
|
-
|
|
1228
|
+
_b = this;
|
|
1226
1229
|
return [4 /*yield*/, QRCode__default["default"].toDataURL(totpCode)];
|
|
1227
1230
|
case 3:
|
|
1228
|
-
|
|
1231
|
+
_b.qrCodeSource = _c.sent();
|
|
1229
1232
|
return [3 /*break*/, 5];
|
|
1230
1233
|
case 4:
|
|
1231
|
-
err_1 =
|
|
1234
|
+
err_1 = _c.sent();
|
|
1232
1235
|
logger.error(err_1);
|
|
1233
1236
|
return [3 /*break*/, 5];
|
|
1234
1237
|
case 5: return [2 /*return*/];
|
|
@@ -1245,12 +1248,16 @@
|
|
|
1245
1248
|
event.preventDefault();
|
|
1246
1249
|
this.authenticator.submitForm();
|
|
1247
1250
|
};
|
|
1251
|
+
SetupTotpComponent.prototype.copyText = function () {
|
|
1252
|
+
navigator.clipboard.writeText(this.secretKey);
|
|
1253
|
+
this.copyTextLabel = ui.translate('COPIED');
|
|
1254
|
+
};
|
|
1248
1255
|
return SetupTotpComponent;
|
|
1249
1256
|
}());
|
|
1250
1257
|
SetupTotpComponent.decorators = [
|
|
1251
1258
|
{ type: i0.Component, args: [{
|
|
1252
1259
|
selector: 'amplify-setup-totp',
|
|
1253
|
-
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n"
|
|
1260
|
+
template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n fill=\"black\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-form-field\n name=\"confirmation_code\"\n label=\"Code *\"\n type=\"text\"\n autocomplete=\"one-time-code\"\n ></amplify-form-field>\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n </form>\n</div>\n"
|
|
1254
1261
|
},] }
|
|
1255
1262
|
];
|
|
1256
1263
|
SetupTotpComponent.ctorParameters = function () { return [
|
|
@@ -1265,7 +1272,10 @@
|
|
|
1265
1272
|
this.authenticator = authenticator;
|
|
1266
1273
|
this.dataAttr = '';
|
|
1267
1274
|
// translated phrases
|
|
1268
|
-
|
|
1275
|
+
// Support backwards compatibility for legacy key with trailing space
|
|
1276
|
+
this.forgotPasswordText = !ui.hasTranslation('Forgot your password? ')
|
|
1277
|
+
? ui.translate('Forgot your password?')
|
|
1278
|
+
: ui.translate('Forgot your password? ');
|
|
1269
1279
|
this.signInButtonText = ui.translate('Sign in');
|
|
1270
1280
|
}
|
|
1271
1281
|
Object.defineProperty(SignInComponent.prototype, "context", {
|