]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/TokenEdit.js
7039249cfaaacd36832703e89b905f8420e9ad2b
1 Ext
.define('PVE.dc.TokenEdit', {
2 extend
: 'Proxmox.window.Edit',
3 alias
: ['widget.pveDcTokenEdit'],
4 mixins
: ['Proxmox.Mixin.CBind'],
6 subject
: gettext('Token'),
7 onlineHelp
: 'pveum_tokens',
14 url
: '/api2/extjs/access/users/',
16 defaultFocus
: 'field[disabled=false][hidden=false][name=tokenid]',
20 onGetValues: function(values
) {
22 let win
= me
.up('pveDcTokenEdit');
23 win
.url
= '/api2/extjs/access/users/';
24 let uid
= encodeURIComponent(values
.userid
);
25 let tid
= encodeURIComponent(values
.tokenid
);
27 delete values
.tokenid
;
29 win
.url
+= `${uid}/token/${tid}`;
34 xtype
: 'pmxDisplayEditField',
36 editable
: (get) => get('isCreate') && !get('fixedUser'),
40 xtype
: 'pveUserSelector',
44 value
: Proxmox
.UserName
,
45 renderer
: Ext
.String
.htmlEncode
,
46 fieldLabel
: gettext('User'),
49 xtype
: 'pmxDisplayEditField',
51 editable
: '{isCreate}',
54 fieldLabel
: gettext('Token ID'),
62 xtype
: 'proxmoxcheckbox',
66 fieldLabel
: gettext('Privilege Separation'),
69 xtype
: 'pmxExpireDate',
77 fieldLabel
: gettext('Comment'),
82 initComponent: function() {
89 success: function(response
, options
) {
90 me
.setValues(response
.result
.data
);
95 apiCallDone: function(success
, response
, options
) {
96 let res
= response
.result
.data
;
97 if (!success
|| !res
.value
) {
101 Ext
.create('PVE.dc.TokenShow', {
103 tokenid
: res
['full-tokenid'],
109 Ext
.define('PVE.dc.TokenShow', {
110 extend
: 'Ext.window.Window',
111 alias
: ['widget.pveTokenShow'],
112 mixins
: ['Proxmox.Mixin.CBind'],
117 title
: gettext('Token Secret'),
129 padding
: '0 10 10 10',
133 fieldLabel
: gettext('Token ID'),
141 fieldLabel
: gettext('Secret'),
142 inputId
: 'token-secret-value',
153 padding
: '10 10 10 10',
155 html
: gettext('Please record the API token secret - it will only be displayed now'),
160 handler: function(b
) {
161 document
.getElementById('token-secret-value').select();
162 document
.execCommand("copy");
164 text
: gettext('Copy Secret Value'),
165 iconCls
: 'fa fa-clipboard',