X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Foauth%2Fapp.ex;h=ddcdb18718b39c7486b3dee5a871145bcb965001;hb=182f7bbb1170c44eac4ab4a9efa4ff0bff991c98;hp=c18e9da8c669f6c9b2c102e17508f284d867d62c;hpb=bee6acd51dc4e84e44caecf9d123dfff2f640a38;p=akkoma
diff --git a/lib/pleroma/web/oauth/app.ex b/lib/pleroma/web/oauth/app.ex
index c18e9da8c..ddcdb1871 100644
--- a/lib/pleroma/web/oauth/app.ex
+++ b/lib/pleroma/web/oauth/app.ex
@@ -1,15 +1,17 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.App do
use Ecto.Schema
- import Ecto.{Changeset}
+ import Ecto.Changeset
+
+ @type t :: %__MODULE__{}
schema "apps" do
field(:client_name, :string)
field(:redirect_uris, :string)
- field(:scopes, :string)
+ field(:scopes, {:array, :string}, default: [])
field(:website, :string)
field(:client_id, :string)
field(:client_secret, :string)
@@ -25,8 +27,14 @@ defmodule Pleroma.Web.OAuth.App do
if changeset.valid? do
changeset
- |> put_change(:client_id, :crypto.strong_rand_bytes(32) |> Base.url_encode64())
- |> put_change(:client_secret, :crypto.strong_rand_bytes(32) |> Base.url_encode64())
+ |> put_change(
+ :client_id,
+ :crypto.strong_rand_bytes(32) |> Base.url_encode64(padding: false)
+ )
+ |> put_change(
+ :client_secret,
+ :crypto.strong_rand_bytes(32) |> Base.url_encode64(padding: false)
+ )
else
changeset
end