Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
a1eafd66
Commit
a1eafd66
authored
Aug 05, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mobile: implement two factor auth
parent
9940ea01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
Login.js
www/mobile/Login.js
+27
-2
RealmSelector.js
www/mobile/RealmSelector.js
+3
-1
No files found.
www/mobile/Login.js
View file @
a1eafd66
...
@@ -30,10 +30,33 @@ Ext.define('PVE.Login', {
...
@@ -30,10 +30,33 @@ Ext.define('PVE.Login', {
name
:
'
password
'
,
name
:
'
password
'
,
required
:
true
required
:
true
},
},
{
xtype
:
'
textfield
'
,
itemId
:
'
otpField
'
,
placeHolder
:
gettext
(
'
OTP
'
),
name
:
'
otp
'
,
allowBlank
:
false
,
hidden
:
true
},
{
{
xtype
:
'
pveRealmSelector
'
,
xtype
:
'
pveRealmSelector
'
,
itemId
:
'
realmSelectorField
'
,
itemId
:
'
realmSelectorField
'
,
name
:
'
realm
'
name
:
'
realm
'
,
listeners
:
{
change
:
function
(
f
,
value
)
{
var
form
=
this
.
up
(
'
formpanel
'
);
var
otp_field
=
form
.
down
(
'
#otpField
'
);
if
(
f
.
needOTP
(
value
))
{
otp_field
.
setHidden
(
false
);
otp_field
.
enable
();
}
else
{
otp_field
.
setHidden
(
true
);
otp_field
.
disable
();
}
}
}
}
}
]
]
},
},
...
@@ -57,6 +80,7 @@ Ext.define('PVE.Login', {
...
@@ -57,6 +80,7 @@ Ext.define('PVE.Login', {
var
usernameField
=
form
.
down
(
'
#userNameTextField
'
),
var
usernameField
=
form
.
down
(
'
#userNameTextField
'
),
passwordField
=
form
.
down
(
'
#passwordTextField
'
),
passwordField
=
form
.
down
(
'
#passwordTextField
'
),
realmField
=
form
.
down
(
'
#realmSelectorField
'
),
realmField
=
form
.
down
(
'
#realmSelectorField
'
),
otpField
=
form
.
down
(
'
#otpField
'
),
label
=
form
.
down
(
'
#signInFailedLabel
'
);
label
=
form
.
down
(
'
#signInFailedLabel
'
);
label
.
hide
();
label
.
hide
();
...
@@ -64,12 +88,13 @@ Ext.define('PVE.Login', {
...
@@ -64,12 +88,13 @@ Ext.define('PVE.Login', {
var
username
=
usernameField
.
getValue
();
var
username
=
usernameField
.
getValue
();
var
password
=
passwordField
.
getValue
();
var
password
=
passwordField
.
getValue
();
var
realm
=
realmField
.
getValue
();
var
realm
=
realmField
.
getValue
();
var
otp
=
otpField
.
getValue
();
PVE
.
Utils
.
API2Request
({
PVE
.
Utils
.
API2Request
({
url
:
'
/access/ticket
'
,
url
:
'
/access/ticket
'
,
method
:
'
POST
'
,
method
:
'
POST
'
,
waitMsgTarget
:
form
,
waitMsgTarget
:
form
,
params
:
{
username
:
username
,
password
:
password
,
realm
:
realm
},
params
:
{
username
:
username
,
password
:
password
,
realm
:
realm
,
otp
:
otp
},
failure
:
function
(
response
,
options
)
{
failure
:
function
(
response
,
options
)
{
label
.
show
();
label
.
show
();
},
},
...
...
www/mobile/RealmSelector.js
View file @
a1eafd66
...
@@ -13,7 +13,9 @@ Ext.define('PVE.form.RealmSelector', {
...
@@ -13,7 +13,9 @@ Ext.define('PVE.form.RealmSelector', {
needOTP
:
function
(
realm
)
{
needOTP
:
function
(
realm
)
{
var
me
=
this
;
var
me
=
this
;
var
rec
=
me
.
store
.
findRecord
(
'
realm
'
,
realm
);
var
realmstore
=
me
.
getStore
();
var
rec
=
realmstore
.
findRecord
(
'
realm
'
,
realm
);
return
rec
&&
rec
.
data
&&
rec
.
data
.
tfa
?
rec
.
data
.
tfa
:
undefined
;
return
rec
&&
rec
.
data
&&
rec
.
data
.
tfa
?
rec
.
data
.
tfa
:
undefined
;
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment