diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl index ffd23b200..c4ef3acb8 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/web/ejabberd_web_admin.erl @@ -1731,6 +1731,27 @@ user_info(User, Server, Query, Lang) -> ?INPUTT("submit", "chpassword", "Change Password")], UserItems = ejabberd_hooks:run_fold(webadmin_user, list_to_binary(LServer), [], [User, Server, Lang]), + %% Code copied from list_given_users/5: + ModLast = get_lastactivity_module(Server), + LastActivity = case ejabberd_sm:get_user_resources(UserB, ServerB) of + [] -> + case ModLast:get_last_info(UserB, ServerB) of + not_found -> + ?T("Never"); + {ok, Shift, _Status} -> + TimeStamp = {Shift div 1000000, + Shift rem 1000000, + 0}, + {{Year, Month, Day}, {Hour, Minute, Second}} = + calendar:now_to_local_time(TimeStamp), + lists:flatten( + io_lib:format( + "~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w", + [Year, Month, Day, Hour, Minute, Second])) + end; + _ -> + ?T("Online") + end, [?XC('h1', ?T("User ") ++ us_to_list(US))] ++ case Res of ok -> [?XREST("Submitted")]; @@ -1740,6 +1761,7 @@ user_info(User, Server, Query, Lang) -> [?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)], [?XCT('h3', "Connected Resources:")] ++ FResources ++ [?XCT('h3', "Password:")] ++ FPassword ++ + [?XCT('h3', "Last Activity")] ++ [?C(LastActivity)] ++ UserItems ++ [?P, ?INPUTT("submit", "removeuser", "Remove User")])].