]>
git.proxmox.com Git - pve-manager.git/blob - www/mobile/Login.js
1 Ext
.define('PVE.Login', {
2 extend
: 'Ext.form.Panel',
3 alias
: "widget.pveLogin",
11 src
: '/pve2/images/proxmox_logo.png',
17 title
: 'Proxmox VE Login',
21 placeHolder
: gettext('User name'),
22 itemId
: 'userNameTextField',
27 xtype
: 'passwordfield',
28 placeHolder
: gettext('Password'),
29 itemId
: 'passwordTextField',
36 placeHolder
: gettext('OTP'),
42 xtype
: 'pveRealmSelector',
43 itemId
: 'realmSelectorField',
46 change: function(f
, value
) {
47 var form
= this.up('formpanel');
49 var otp_field
= form
.down('#otpField');
51 if (f
.needOTP(value
)) {
52 otp_field
.setHidden(false);
55 otp_field
.setHidden(true);
65 html
: 'Login failed. Please enter the correct credentials.',
66 itemId
: 'signInFailedLabel',
68 hideAnimation
: 'fadeOut',
69 showAnimation
: 'fadeIn',
70 style
: 'color:#990000;margin:5px 0px;'
74 itemId
: 'logInButton',
78 var form
= this.up('formpanel');
80 var usernameField
= form
.down('#userNameTextField'),
81 passwordField
= form
.down('#passwordTextField'),
82 realmField
= form
.down('#realmSelectorField'),
83 otpField
= form
.down('#otpField'),
84 label
= form
.down('#signInFailedLabel');
88 var username
= usernameField
.getValue();
89 var password
= passwordField
.getValue();
90 var realm
= realmField
.getValue();
91 var otp
= otpField
.getValue();
93 PVE
.Utils
.API2Request({
94 url
: '/access/ticket',
97 params
: { username
: username
, password
: password
, realm
: realm
, otp
: otp
},
98 failure: function(response
, options
) {
101 success: function(response
, options
) {
102 usernameField
.setValue('');
103 passwordField
.setValue('');
104 PVE
.Workspace
.updateLoginData(response
.result
.data
);