WebUI: Fix calling undefined method during reset passwords

When calling reset password the whoami command is not called in batch
command, therefore the result is different then in calling
during reset password operation. That needs to be handled to properly
set entity_show method which needs to be called after to gather
data about logged in entity.

https://pagure.io/freeipa/issue/7143

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Pavel Vomacka
2017-09-06 15:20:07 +02:00
committed by Stanislav Laznicka
parent 755a50044c
commit a7ab63b84c

View File

@@ -264,18 +264,19 @@ var IPA = function () {
return rpc.command({
method: 'whoami',
on_success: function(data, text_status, xhr) {
that.whoami.metadata = data;
that.whoami.metadata = data.result || data;
var wa_data = that.whoami.metadata;
rpc.command({
method: data.details || data.command,
args: data.arguments,
method: wa_data.details || wa_data.command,
args: wa_data.arguments,
options: function() {
var options = data.options || [];
var options = wa_data.options || [];
$.extend(options, {all: true});
return options;
}(),
on_success: function(data, text_status, xhr) {
that.whoami.data = false ? data.result[0] : data.result.result;
that.whoami.data = data.result.result;
var entity = that.whoami.metadata.object;
if (entity === 'user') {