mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed inconsistent layout for password reset dialog.
The dialog box for resetting user password has been modified to use the standard layout. Ticket #1641
This commit is contained in:
parent
c94ebfcb84
commit
4691f1eda8
@ -321,68 +321,43 @@ IPA.user_password_widget = function(spec) {
|
|||||||
width: 400
|
width: 400
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.create = function() {
|
var password1 = dialog.add_field(IPA.text_widget({
|
||||||
|
name: 'password1',
|
||||||
|
label: IPA.messages.objects.user.new_password,
|
||||||
|
type: 'password',
|
||||||
|
undo: false
|
||||||
|
}));
|
||||||
|
|
||||||
var dl = $('<dl/>', {
|
var password2 = dialog.add_field(IPA.text_widget({
|
||||||
'class': 'modal'
|
name: 'password2',
|
||||||
}).appendTo(dialog.container);
|
label: IPA.messages.objects.user.repeat_password,
|
||||||
|
type: 'password',
|
||||||
$('<dt/>', {
|
undo: false
|
||||||
html: IPA.messages.objects.user.new_password
|
}));
|
||||||
}).appendTo(dl);
|
|
||||||
|
|
||||||
var dd = $('<dd/>').appendTo(dl);
|
|
||||||
|
|
||||||
dialog.password1 = $('<input/>', {
|
|
||||||
type: 'password'
|
|
||||||
}).appendTo(dd);
|
|
||||||
|
|
||||||
$('<dt/>', {
|
|
||||||
html: IPA.messages.objects.user.repeat_password
|
|
||||||
}).appendTo(dl);
|
|
||||||
|
|
||||||
dd = $('<dd/>').appendTo(dl);
|
|
||||||
|
|
||||||
dialog.password2 = $('<input/>', {
|
|
||||||
type: 'password'
|
|
||||||
}).appendTo(dd);
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.add_button(IPA.messages.objects.user.reset_password, function() {
|
dialog.add_button(IPA.messages.objects.user.reset_password, function() {
|
||||||
|
|
||||||
var new_password = dialog.password1.val();
|
var record = {};
|
||||||
var repeat_password = dialog.password2.val();
|
dialog.save(record);
|
||||||
|
|
||||||
|
var new_password = record.password1;
|
||||||
|
var repeat_password = record.password2;
|
||||||
|
|
||||||
if (new_password != repeat_password) {
|
if (new_password != repeat_password) {
|
||||||
alert(IPA.messages.objects.user.password_must_match);
|
alert(IPA.messages.objects.user.password_must_match);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var user_pkey = IPA.nav.get_state('user-pkey');
|
that.set_password(
|
||||||
|
new_password,
|
||||||
var args;
|
function(data, text_status, xhr) {
|
||||||
if (user_pkey === IPA.whoami.uid[0]) {
|
|
||||||
args = [];
|
|
||||||
} else {
|
|
||||||
args = [user_pkey];
|
|
||||||
}
|
|
||||||
|
|
||||||
var command = IPA.command({
|
|
||||||
method: 'passwd',
|
|
||||||
args: args,
|
|
||||||
options: {
|
|
||||||
password: new_password
|
|
||||||
},
|
|
||||||
on_success: function(data, text_status, xhr) {
|
|
||||||
alert(IPA.messages.objects.user.password_change_complete);
|
alert(IPA.messages.objects.user.password_change_complete);
|
||||||
dialog.close();
|
dialog.close();
|
||||||
},
|
},
|
||||||
on_error: function(xhr, text_status, error_thrown) {
|
function(xhr, text_status, error_thrown) {
|
||||||
dialog.close();
|
dialog.close();
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
command.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.add_button(IPA.messages.buttons.cancel, function() {
|
dialog.add_button(IPA.messages.buttons.cancel, function() {
|
||||||
@ -392,5 +367,28 @@ IPA.user_password_widget = function(spec) {
|
|||||||
dialog.open(that.container);
|
dialog.open(that.container);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.set_password = function(password, on_success, on_error) {
|
||||||
|
var user_pkey = IPA.nav.get_state('user-pkey');
|
||||||
|
|
||||||
|
var args;
|
||||||
|
if (user_pkey === IPA.whoami.uid[0]) {
|
||||||
|
args = [];
|
||||||
|
} else {
|
||||||
|
args = [user_pkey];
|
||||||
|
}
|
||||||
|
|
||||||
|
var command = IPA.command({
|
||||||
|
method: 'passwd',
|
||||||
|
args: args,
|
||||||
|
options: {
|
||||||
|
password: password
|
||||||
|
},
|
||||||
|
on_success: on_success,
|
||||||
|
on_error: on_error
|
||||||
|
});
|
||||||
|
|
||||||
|
command.execute();
|
||||||
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user