X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2FPasswordResetToken.ex;h=c3c0384d234d803311047d9779288bdc559460dc;hb=69a38644bc20f49390717f06be30cc2874f7b6f7;hp=52b1fcd503d465afa761d0c3a73d804b92fe3aa3;hpb=30e9b22f96f2bf1cd895e993190f40afba159bb6;p=akkoma diff --git a/lib/pleroma/PasswordResetToken.ex b/lib/pleroma/PasswordResetToken.ex index 52b1fcd50..c3c0384d2 100644 --- a/lib/pleroma/PasswordResetToken.ex +++ b/lib/pleroma/PasswordResetToken.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.PasswordResetToken do use Ecto.Schema @@ -6,15 +10,15 @@ defmodule Pleroma.PasswordResetToken do alias Pleroma.{User, PasswordResetToken, Repo} schema "password_reset_tokens" do - belongs_to :user, User - field :token, :string - field :used, :boolean, default: false + belongs_to(:user, User, type: Pleroma.FlakeId) + field(:token, :string) + field(:used, :boolean, default: false) timestamps() end def create_token(%User{} = user) do - token = :crypto.strong_rand_bytes(32) |> Base.url_encode64 + token = :crypto.strong_rand_bytes(32) |> Base.url_encode64() token = %PasswordResetToken{ user_id: user.id,