]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/window/TfaEdit.js
1 Ext
.define('Proxmox.window.TfaEdit', {
2 extend
: 'Proxmox.window.Edit',
3 alias
: 'widget.pmxTfaEdit',
4 mixins
: ['Proxmox.Mixin.CBind'],
6 onlineHelp
: 'user_mgmt',
10 title
: gettext("Modify a TFA entry's description"),
18 cbindData: function(initialConfig
) {
21 let tfa_id
= initialConfig
['tfa-id'];
23 me
.defaultFocus
= 'textfield[name=description]';
24 me
.url
= `/api2/extjs/access/tfa/${tfa_id}`;
30 initComponent: function() {
34 if (Proxmox
.UserName
=== 'root@pam') {
35 me
.lookup('password').setVisible(false);
36 me
.lookup('password').setDisabled(true);
39 let userid
= me
.tfa_id
.split('/')[0];
40 me
.lookup('userid').setValue(userid
);
45 xtype
: 'displayfield',
48 fieldLabel
: gettext('User'),
50 xtype
: 'pmxUserSelector',
54 value
: () => Proxmox
.UserName
,
58 xtype
: 'proxmoxtextfield',
61 fieldLabel
: gettext('Description'),
64 xtype
: 'proxmoxcheckbox',
65 fieldLabel
: gettext('Enabled'),
73 inputType
: 'password',
74 fieldLabel
: gettext('Password'),
76 reference
: 'password',
80 emptyText
: gettext('verify current password'),
84 getValues: function() {
87 var values
= me
.callParent(arguments
);
95 Ext
.define('Proxmox.tfa.confirmRemove', {
96 extend
: 'Proxmox.window.Edit',
97 mixins
: ['Proxmox.Mixin.CBind'],
99 title
: gettext("Confirm TFA Removal"),
104 isCreate
: true, // logic
109 initComponent: function() {
112 if (typeof me
.type
!== "string") {
113 throw "missing type";
117 throw "missing callback";
122 if (Proxmox
.UserName
=== 'root@pam') {
123 me
.lookup('password').setVisible(false);
124 me
.lookup('password').setDisabled(true);
130 if (Proxmox
.UserName
=== 'root@pam') {
133 me
.callback(me
.lookup('password').getValue());
142 html
: Ext
.String
.format(
143 gettext('Are you sure you want to remove this {0} entry?'),
168 xtype
: 'displayfield',
169 fieldLabel
: gettext('User'),
175 xtype
: 'displayfield',
176 fieldLabel
: gettext('Type'),
191 xtype
: 'displayfield',
192 fieldLabel
: gettext('Created'),
193 renderer
: v
=> Proxmox
.Utils
.render_timestamp(v
),
200 fieldLabel
: gettext('Description'),
202 value
: '{description}',
204 emptyText
: Proxmox
.Utils
.NoneText
,
214 inputType
: 'password',
215 fieldLabel
: gettext('Password'),
217 reference
: 'password',
224 Ext
.String
.format(gettext("Confirm your ({0}) password"), Proxmox
.UserName
),