]> granicus.if.org Git - ejabberd/commitdiff
oauth: single jid field instead of username/password fields
authorPablo Polvorin <pablo@work>
Fri, 22 Jul 2016 18:37:48 +0000 (15:37 -0300)
committerPablo Polvorin <pablo@work>
Fri, 22 Jul 2016 18:37:48 +0000 (15:37 -0300)
src/ejabberd_oauth.erl

index 2d3cb03f3eda724d287855cf4c23aca16be300fb..b2192a78147d37b5ba72e8577098b0fbdb3acfe6 100644 (file)
@@ -375,12 +375,9 @@ process(_Handlers,
         ?XAE(<<"form">>,
              [{<<"action">>, <<"authorization_token">>},
               {<<"method">>, <<"post">>}],
-             [?LABEL(<<"username">>, [?CT(<<"User">>), ?C(<<": ">>)]),
+             [?LABEL(<<"username">>, [?CT(<<"User (jid)">>), ?C(<<": ">>)]),
               ?INPUTID(<<"text">>, <<"username">>, <<"">>),
               ?BR,
-              ?LABEL(<<"server">>, [?CT(<<"Server">>), ?C(<<": ">>)]),
-              ?INPUTID(<<"text">>, <<"server">>, <<"">>),
-              ?BR,
               ?LABEL(<<"password">>, [?CT(<<"Password">>), ?C(<<": ">>)]),
               ?INPUTID(<<"password">>, <<"password">>, <<"">>),
               ?INPUT(<<"hidden">>, <<"response_type">>, ResponseType),
@@ -443,8 +440,8 @@ process(_Handlers,
     ClientId = proplists:get_value(<<"client_id">>, Q, <<"">>),
     RedirectURI = proplists:get_value(<<"redirect_uri">>, Q, <<"">>),
     SScope = proplists:get_value(<<"scope">>, Q, <<"">>),
-    Username = proplists:get_value(<<"username">>, Q, <<"">>),
-    Server = proplists:get_value(<<"server">>, Q, <<"">>),
+    StringJID = proplists:get_value(<<"username">>, Q, <<"">>),
+    #jid{user = Username, server = Server} = jid:from_string(StringJID),
     Password = proplists:get_value(<<"password">>, Q, <<"">>),
     State = proplists:get_value(<<"state">>, Q, <<"">>),
     Scope = str:tokens(SScope, <<" ">>),