【发布时间】:2016-10-08 09:13:27
【问题描述】:
我正在尝试为 Phoenix 编写一个小型应用程序。我通过示例进行了身份验证http://meatherly.github.io/2015/05/11/phoenixauthentication/
我认为一切顺利,但我不知道如何处理 current_user 的数据。 如果我在控制器中写:
user = conn.assigns.current_user
IO.inspect user
我明白了:
{:ok,
%Myfiles.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
encrypted_password: "$2b$12$KLDREZ08084BhHXrJR8EAuQinHn.X2X9OlfylelYiK5KSinlxfTii",
id: 1, inserted_at: #Ecto.DateTime<2016-10-07 21:28:51>, password: "123456",
password_confirmation: "123456",
updated_at: #Ecto.DateTime<2016-10-07 21:28:51>, username: "test"}}
这不是地图吗? id怎么离开这里?
【问题讨论】:
标签: authentication elixir phoenix-framework