aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2022-11-16 18:48:08 +0100
committerBadlop <badlop@process-one.net>2022-11-23 18:40:26 +0100
commit266dd98521fd906602d41d754862bd2e8d0a5b77 (patch)
treef6d48b9fa88b9b98e28db655d08e89f84b2f6e32
parentOAuth: Handle when client is not identified (diff)
OAuth: Accept jid as a HTTP URL query argument
-rw-r--r--src/ejabberd_oauth.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ejabberd_oauth.erl b/src/ejabberd_oauth.erl
index a70ca6bae..51e95a306 100644
--- a/src/ejabberd_oauth.erl
+++ b/src/ejabberd_oauth.erl
@@ -500,6 +500,10 @@ process(_Handlers,
path = [_, <<"authorization_token">>]}) ->
ResponseType = proplists:get_value(<<"response_type">>, Q, <<"">>),
ClientId = proplists:get_value(<<"client_id">>, Q, <<"">>),
+ JidEls = case proplists:get_value(<<"jid">>, Q, <<"">>) of
+ <<"">> -> [?INPUTID(<<"email">>, <<"username">>, <<"">>)];
+ Jid -> [?C(Jid), ?INPUT(<<"hidden">>, <<"username">>, Jid)]
+ end,
RedirectURI = proplists:get_value(<<"redirect_uri">>, Q, <<"">>),
Scope = proplists:get_value(<<"scope">>, Q, <<"">>),
State = proplists:get_value(<<"state">>, Q, <<"">>),
@@ -507,8 +511,8 @@ process(_Handlers,
?XAE(<<"form">>,
[{<<"action">>, <<"authorization_token">>},
{<<"method">>, <<"post">>}],
- [?LABEL(<<"username">>, [?CT(?T("User (jid)")), ?C(<<": ">>)]),
- ?INPUTID(<<"email">>, <<"username">>, <<"">>),
+ [?LABEL(<<"username">>, [?CT(?T("User (jid)")), ?C(<<": ">>)])
+ ] ++ JidEls ++ [
?BR,
?LABEL(<<"password">>, [?CT(?T("Password")), ?C(<<": ">>)]),
?INPUTID(<<"password">>, <<"password">>, <<"">>),