25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +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, {401,
[{<<"WWW-Authenticate">>, [{<<"WWW-Authenticate">>,
<<"basic realm=\"ejabberd\"">>}], <<"basic realm=\"ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>, ejabberd_web:make_xhtml(make_unauthorized(Lang))};
?T("Unauthorized"))])};
{unauthorized, Error} -> {unauthorized, Error} ->
{BadUser, _BadPass} = Auth, {BadUser, _BadPass} = Auth,
{IPT, _Port} = Request#request.ip, {IPT, _Port} = Request#request.ip,
@ -186,8 +185,7 @@ process2([<<"server">>, SHost | RPath] = Path,
[{<<"WWW-Authenticate">>, [{<<"WWW-Authenticate">>,
<<"basic realm=\"auth error, retry login " <<"basic realm=\"auth error, retry login "
"to ejabberd\"">>}], "to ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>, ejabberd_web:make_xhtml(make_unauthorized(Lang))}
?T("Unauthorized"))])}
end; end;
false -> ejabberd_web:error(not_found) false -> ejabberd_web:error(not_found)
end; end;
@ -206,8 +204,7 @@ process2(RPath,
{401, {401,
[{<<"WWW-Authenticate">>, [{<<"WWW-Authenticate">>,
<<"basic realm=\"ejabberd\"">>}], <<"basic realm=\"ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>, ejabberd_web:make_xhtml(make_unauthorized(Lang))};
?T("Unauthorized"))])};
{unauthorized, Error} -> {unauthorized, Error} ->
{BadUser, _BadPass} = Auth, {BadUser, _BadPass} = Auth,
{IPT, _Port} = Request#request.ip, {IPT, _Port} = Request#request.ip,
@ -218,10 +215,14 @@ process2(RPath,
[{<<"WWW-Authenticate">>, [{<<"WWW-Authenticate">>,
<<"basic realm=\"auth error, retry login " <<"basic realm=\"auth error, retry login "
"to ejabberd\"">>}], "to ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>, ejabberd_web:make_xhtml(make_unauthorized(Lang))}
?T("Unauthorized"))])}
end. 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) -> get_auth_admin(Auth, HostHTTP, RPath, Method) ->
case Auth of case Auth of
{SJID, Pass} -> {SJID, Pass} ->