25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

WebAdmin: Unauthorized response: include some text to direct to the logs

This commit is contained in:
Badlop 2024-05-17 15:33:48 +02:00
parent a16e5a7055
commit 724f304e48

View File

@ -174,8 +174,7 @@ process2([<<"server">>, SHost | RPath] = Path,
{401,
[{<<"WWW-Authenticate">>,
<<"basic realm=\"ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
?T("Unauthorized"))])};
ejabberd_web:make_xhtml(make_unauthorized(Lang))};
{unauthorized, Error} ->
{BadUser, _BadPass} = Auth,
{IPT, _Port} = Request#request.ip,
@ -186,8 +185,7 @@ process2([<<"server">>, SHost | RPath] = Path,
[{<<"WWW-Authenticate">>,
<<"basic realm=\"auth error, retry login "
"to ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
?T("Unauthorized"))])}
ejabberd_web:make_xhtml(make_unauthorized(Lang))}
end;
false -> ejabberd_web:error(not_found)
end;
@ -206,8 +204,7 @@ process2(RPath,
{401,
[{<<"WWW-Authenticate">>,
<<"basic realm=\"ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
?T("Unauthorized"))])};
ejabberd_web:make_xhtml(make_unauthorized(Lang))};
{unauthorized, Error} ->
{BadUser, _BadPass} = Auth,
{IPT, _Port} = Request#request.ip,
@ -218,10 +215,14 @@ process2(RPath,
[{<<"WWW-Authenticate">>,
<<"basic realm=\"auth error, retry login "
"to ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
?T("Unauthorized"))])}
ejabberd_web:make_xhtml(make_unauthorized(Lang))}
end.
make_unauthorized(Lang) ->
[?XCT(<<"h1">>, ?T("Unauthorized")),
?XE(<<"p">>, [?C(<<"There was some problem authenticating, or the account doesn't have privilege.">>)]),
?XE(<<"p">>, [?C(<<"Please check the log file for a more precise error message.">>)])].
get_auth_admin(Auth, HostHTTP, RPath, Method) ->
case Auth of
{SJID, Pass} ->