diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/polyjuice/client/endpoint/post_register.ex | 4 | ||||
-rw-r--r-- | lib/polyjuice/client/low_level.ex | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/polyjuice/client/endpoint/post_register.ex b/lib/polyjuice/client/endpoint/post_register.ex index df10a8c..fc13648 100644 --- a/lib/polyjuice/client/endpoint/post_register.ex +++ b/lib/polyjuice/client/endpoint/post_register.ex @@ -22,6 +22,7 @@ defmodule Polyjuice.Client.Endpoint.PostRegister do @type t :: %__MODULE__{ kind: :guest | :user, auth: %{type: String.t(), session: String.t() | nil}, + type: String.t(), username: String.t() | nil, password: String.t() | nil, device_id: String.t() | nil, @@ -32,6 +33,7 @@ defmodule Polyjuice.Client.Endpoint.PostRegister do @enforce_keys [:auth] defstruct [ :kind, + :type, :auth, :username, :password, @@ -44,6 +46,7 @@ defmodule Polyjuice.Client.Endpoint.PostRegister do def http_spec(%Polyjuice.Client.Endpoint.PostRegister{ kind: kind, auth: auth, + type: type, username: username, password: password, device_id: device_id, @@ -53,6 +56,7 @@ defmodule Polyjuice.Client.Endpoint.PostRegister do body = [ if(auth != nil, do: [{"auth", auth}], else: []), + if(type != nil, do: [{"type", type}], else: []), if(username != nil, do: [{"username", username}], else: []), if(password != nil, do: [{"password", password}], else: []), if(device_id != nil, do: [{"device_id", device_id}], else: []), diff --git a/lib/polyjuice/client/low_level.ex b/lib/polyjuice/client/low_level.ex index 94dbcb6..12afb51 100644 --- a/lib/polyjuice/client/low_level.ex +++ b/lib/polyjuice/client/low_level.ex @@ -75,7 +75,7 @@ defmodule Polyjuice.Client.LowLevel do query = query || [] - query = if application_service, do: [{:user_id, user_id} | query], else: query + query = if application_service && user_id, do: [{:user_id, user_id} | query], else: query url = %{ @@ -245,7 +245,8 @@ defmodule Polyjuice.Client.LowLevel do client, %Polyjuice.Client.Endpoint.PostRegister{ kind: Keyword.get(opts, :kind, :user), - auth: %{type: "m.login.dummy"}, + auth: Keyword.get(opts, :auth), + type: Keyword.get(opts, :type), username: Keyword.get(opts, :username), password: Keyword.get(opts, :password), device_id: Keyword.get(opts, :device_id), |