Tweaks to OAuth entities expiration: changed default to 30 days, removed hardcoded values usage, fixed OAuthView (expires_in).
This commit is contained in:
parent
c308224aaf
commit
7fff9c1bee
8 changed files with 14 additions and 17 deletions
|
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.OAuth.Authorization do
|
|||
alias Pleroma.User
|
||||
alias Pleroma.Web.OAuth.App
|
||||
alias Pleroma.Web.OAuth.Authorization
|
||||
alias Pleroma.Web.OAuth.Token
|
||||
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
|
|
@ -53,7 +54,8 @@ defmodule Pleroma.Web.OAuth.Authorization do
|
|||
end
|
||||
|
||||
defp add_lifetime(changeset) do
|
||||
put_change(changeset, :valid_until, NaiveDateTime.add(NaiveDateTime.utc_now(), 60 * 10))
|
||||
lifespan = Token.lifespan()
|
||||
put_change(changeset, :valid_until, NaiveDateTime.add(NaiveDateTime.utc_now(), lifespan))
|
||||
end
|
||||
|
||||
@spec use_changeset(Authtorizatiton.t(), map()) :: Changeset.t()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue