[info] GET /admins/settings
[debug] Processing with TennisWeb.AdminSettingsLive.edit/2
Parameters: %{}
Pipelines: [:browser, :require_authenticated_admin]
[info] Sent 302 in 2ms
[debug] Phoenix.Router halted in :require_authenticated_admin/2
[info] GET /admins/log_in
[debug] Processing with TennisWeb.AdminLoginLive.new/2
Parameters: %{}
Pipelines: [:browser, :redirect_if_admin_is_authenticated]
[debug] QUERY OK source="admins_tokens" db=0.4ms idle=1810.1ms
SELECT a1."id", a1."email", a1."hashed_password", a1."confirmed_at", a1."inserted_at", a1."updated_at" FROM "admins_tokens" AS a0 INNER JOIN "admins" AS a1 ON a1."id" = a0."admin_id" WHERE ((a0."token" = $1) AND (a0."context" = $2)) AND (a0."inserted_at" > $3::timestamp + (-(60)::numeric * interval '1 day')) [<<91, 7, 196, 251, 187, 59, 123, 226, 144, 242, 237, 59, 30, 141, 172, 17, 182, 223, 9, 196, 98, 3, 145, 43, 120, 187, 24, 4, 60, 174, 153, 132>>, "session", ~U[2023-08-15 07:21:17.743217Z]]
↳ Phoenix.LiveView.Utils.assign_new/3, at: lib/phoenix_live_view/utils.ex:79
[info] Sent 302 in 2ms
[info] GET /
As I read this, it first stops to require_authenticated_admin, it thinks that there is no admin logged in, it redirects to admins/log_in, but oh, there is an admin.
[
%Tennis.Accounts.AdminToken{
__meta__: #Ecto.Schema.Metadata<:loaded, "admins_tokens">,
id: 1,
token: <<114, 195, 157, 169, 173, 83, 53, 117, 118, 11, 231, 83, 96, 36, 15,
147, 51, 95, 25, 250, 239, 158, 80, 40, 63, 82, 98, 76, 60, 209, 214,
65>>,
context: "confirm",
sent_to: "email@email.com",
admin_id: 1,
admin: #Ecto.Association.NotLoaded<association :admin is not loaded>,
inserted_at: ~N[2023-08-14 13:52:24]
},
%Tennis.Accounts.AdminToken{
__meta__: #Ecto.Schema.Metadata<:loaded, "admins_tokens">,
id: 3,
token: <<89, 211, 31, 60, 6, 252, 8, 27, 0, 27, 37, 212, 226, 216, 144, 185,
169, 42, 128, 206, 205, 179, 101, 156, 98, 117, 162, 251, 41, 208, 180,
27>>,
context: "session",
sent_to: nil,
admin_id: 1,
admin: #Ecto.Association.NotLoaded<association :admin is not loaded>,
inserted_at: ~N[2023-08-14 14:09:25]
},
%Tennis.Accounts.AdminToken{
__meta__: #Ecto.Schema.Metadata<:loaded, "admins_tokens">,
id: 4,
token: <<195, 253, 194, 97, 145, 168, 158, 89, 248, 62, 49, 68, 176, 90, 49,
140, 94, 213, 129, 77, 83, 14, 34, 128, 46, 158, 194, 117, 218, 217, 130,
7>>,
context: "session",
sent_to: nil,
admin_id: 1,
admin: #Ecto.Association.NotLoaded<association :admin is not loaded>,
inserted_at: ~N[2023-08-14 16:50:56]
},
%Tennis.Accounts.AdminToken{
__meta__: #Ecto.Schema.Metadata<:loaded, "admins_tokens">,
id: 6,
token: <<96, 18, 203, 223, 86, 21, 223, 199, 81, 181, 7, 82, 249, 87, 236,
227, 29, 249, 41, 72, 96, 244, 167, 170, 121, 125, 45, 13, 249, 166, 240,
42>>,
context: "session",
sent_to: nil,
admin_id: 1,
admin: #Ecto.Association.NotLoaded<association :admin is not loaded>,
inserted_at: ~N[2023-08-15 07:25:30]
}
]
The query is pulling up token records. But, if the token in the [debug] ends with 153, 132
- there is no suck token in Tennis.Accounts.AdminToken
. That means the token is not properly recorded to SQL (postgres)?