WebUI: move OTP to be the last field in the PW reset form

Since TOTPs have a limited validity, let the user enter
them as the last item in the form.
This reduces the chance of the TOTP getting invalid while
the user is still filling out other fields.

Related: https://pagure.io/freeipa/issue/5628
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
This commit is contained in:
Peter Keresztes Schmidt 2020-06-09 23:00:21 +02:00 committed by Florence Blanc-Renaud
parent 3ecea7800a
commit 13b177822e
3 changed files with 20 additions and 18 deletions

View File

@ -776,13 +776,15 @@ IPA.user.password_dialog_pre_op0 = function(spec) {
IPA.user.password_dialog_pre_op = function(spec) {
spec.sections[0].fields.splice(0, 0, {
spec.sections[0].fields.unshift({
name: 'current_password',
label: '@i18n:password.current_password',
$type: 'password',
required: true
}, {
name: 'otp',
});
spec.sections[0].fields.push({
name: 'otp',
label: '@i18n:password.otp',
$type: 'password'
});

View File

@ -673,17 +673,6 @@ define(['dojo/_base/declare',
show_errors: false,
undo: false
},
{
name: 'otp',
$type: 'password',
label: text.get('@i18n:password.otp', "OTP"),
placeholder: text.get(
'@i18n:password.otp_long',
'One-Time-Password'
),
show_errors: false,
undo: false
},
{
name: 'new_password',
$type: 'password',
@ -717,6 +706,17 @@ define(['dojo/_base/declare',
}],
show_errors: false,
undo: false
},
{
name: 'otp',
$type: 'password',
label: text.get('@i18n:password.otp', "OTP"),
placeholder: text.get(
'@i18n:password.otp_long',
'One-Time-Password'
),
show_errors: false,
undo: false
}
];

View File

@ -58,12 +58,12 @@ RESET_AND_LOGIN_FORM = {
PKEY, None),
('current_password', 'Current Password', False, True, 'password',
'current_password', '', 'Current Password'),
('otp', 'OTP', False, True, 'password', 'otp', '',
'One-Time-Password'),
('new_password', 'New Password', True, True, 'password',
'new_password', '', 'New Password'),
('verify_password', 'Verify Password', True, True, 'password',
'verify_password', '', 'New Password'),
('otp', 'OTP', False, True, 'password', 'otp', '',
'One-Time-Password'),
],
# structure of buttons
# button_name, button_title
@ -89,12 +89,12 @@ RESET_PASSWORD_FORM = {
'Username'),
('current_password', 'Current Password', True, True, 'password',
'current_password', '', 'Current Password'),
('otp', 'OTP', False, True, 'password', 'otp', '',
'One-Time-Password'),
('new_password', 'New Password', True, True, 'password',
'new_password', '', 'New Password'),
('verify_password', 'Verify Password', True, True, 'password',
'verify_password', '', 'New Password'),
('otp', 'OTP', False, True, 'password', 'otp', '',
'One-Time-Password'),
],
# structure of buttons
# button_name, button_title