]>
git.proxmox.com Git - pmg-gui.git/blob - js/TFAView.js
1 // TODO merge with the one from pbs in widget toolkit
2 Ext
.define('PMG.WebauthnConfigEdit', {
3 extend
: 'Proxmox.window.Edit',
4 alias
: ['widget.pmgWebauthnConfigEdit'],
6 subject
: gettext('Webauthn'),
7 url
: "/api2/extjs/config/tfa/webauthn",
16 setValues: function(values
) {
19 me
.relayingPartySet
= values
&& typeof values
.rp
=== 'string';
21 me
.callParent(arguments
);
27 fieldLabel
: gettext('Relying Party'),
31 dirtychange: function(field
, isDirty
) {
32 let win
= field
.up('window');
33 let warningBox
= win
.down('box[id=rpChangeWarning]');
34 warningBox
.setHidden(!win
.relayingPartySet
|| !isDirty
);
40 fieldLabel
: gettext('Origin'),
60 text
: gettext('Auto-fill'),
61 iconCls
: 'fa fa-fw fa-pencil-square-o',
62 handler: function(button
, ev
) {
63 let panel
= this.up('panel');
64 panel
.down('field[name=rp]').setValue(document
.location
.hostname
);
65 panel
.down('field[name=origin]').setValue(document
.location
.origin
);
66 panel
.down('field[name=id]').setValue(document
.location
.hostname
);
73 html
: `<span class='pmx-hint'>${gettext('Note:')}</span> `
74 + gettext('WebAuthn requires using a trusted certificate.'),
78 id
: 'rpChangeWarning',
81 html
: '<i class="fa fa-exclamation-triangle warning"></i> '
82 + gettext('Changing the Relying Party may break existing webAuthn TFA entries.'),
87 Ext
.define('PMG.TFAView', {
88 extend
: 'Proxmox.panel.TfaView',
89 alias
: 'widget.pmgTFAView',
91 initComponent: function() {
97 text
: gettext('WebAuthn '),
99 iconCls
: 'fa fa-fw fa-cog',
100 handler
: () => Ext
.create('PMG.WebauthnConfigEdit', { autoShow
: true }),
104 me
.callParent(arguments
);