forked from potsda.mn/mobilizon
fix(apps): fix typo in redirect_uri parameter
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
fa16537290
commit
5664625c1c
|
@ -40,4 +40,5 @@ FE1EEB91EA633570F703B251AE2D4D4E
|
||||||
7EEC79571F3F7CEEB04A8B86D908382A
|
7EEC79571F3F7CEEB04A8B86D908382A
|
||||||
E7967805C1EA5301F2722C7BDB2F25F3
|
E7967805C1EA5301F2722C7BDB2F25F3
|
||||||
BDFB0FB1AAF69C18212CBCFD42F8B717
|
BDFB0FB1AAF69C18212CBCFD42F8B717
|
||||||
40220A533CCACB3A1CE9DBF1A8A430A1
|
40220A533CCACB3A1CE9DBF1A8A430A1
|
||||||
|
EEB29D1DDA3A3015BC645A989B5BD38E
|
|
@ -13,7 +13,7 @@ defmodule Mobilizon.Web.ApplicationController do
|
||||||
@spec create_application(Plug.Conn.t(), map()) :: Plug.Conn.t()
|
@spec create_application(Plug.Conn.t(), map()) :: Plug.Conn.t()
|
||||||
def create_application(
|
def create_application(
|
||||||
conn,
|
conn,
|
||||||
%{"name" => name, "redirect_uris" => redirect_uris, "scope" => scope} = args
|
%{"name" => name, "redirect_uri" => redirect_uris, "scope" => scope} = args
|
||||||
) do
|
) do
|
||||||
ip = conn.remote_ip |> :inet.ntoa() |> to_string()
|
ip = conn.remote_ip |> :inet.ntoa() |> to_string()
|
||||||
|
|
||||||
|
@ -33,7 +33,9 @@ defmodule Mobilizon.Web.ApplicationController do
|
||||||
conn
|
conn
|
||||||
|> Plug.Conn.put_resp_header("cache-control", "no-store")
|
|> Plug.Conn.put_resp_header("cache-control", "no-store")
|
||||||
|> json(
|
|> json(
|
||||||
Map.take(app, [:name, :website, :redirect_uris, :client_id, :client_secret, :scope])
|
app
|
||||||
|
|> Map.take([:name, :website, :client_id, :client_secret, :scope])
|
||||||
|
|> Map.put(:redirect_uri, app.redirect_uris)
|
||||||
)
|
)
|
||||||
|
|
||||||
{:error, :invalid_scope} ->
|
{:error, :invalid_scope} ->
|
||||||
|
|
|
@ -24,7 +24,7 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
|
||||||
conn
|
conn
|
||||||
|> post("/apps", %{
|
|> post("/apps", %{
|
||||||
"name" => "hello",
|
"name" => "hello",
|
||||||
"redirect_uris" => "hello",
|
"redirect_uri" => "hello",
|
||||||
"scope" => "write nothing"
|
"scope" => "write nothing"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -46,14 +46,14 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
|
||||||
conn
|
conn
|
||||||
|> post("/apps", %{
|
|> post("/apps", %{
|
||||||
"name" => name,
|
"name" => name,
|
||||||
"redirect_uris" => Enum.join(redirect_uris, "\n"),
|
"redirect_uri" => Enum.join(redirect_uris, "\n"),
|
||||||
"scope" => scope,
|
"scope" => scope,
|
||||||
"website" => website
|
"website" => website
|
||||||
})
|
})
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
"name" => ^name,
|
"name" => ^name,
|
||||||
"redirect_uris" => ^redirect_uris,
|
"redirect_uri" => ^redirect_uris,
|
||||||
"scope" => ^scope,
|
"scope" => ^scope,
|
||||||
"website" => ^website,
|
"website" => ^website,
|
||||||
"client_id" => _client_id,
|
"client_id" => _client_id,
|
||||||
|
|
Loading…
Reference in a new issue