{@thread.name}

talha-azeem:

I was looking into the register_form.ex and found a key @strategy. What is it used for?

ZachDaniel:

The strategy is the configuration for which authentication strategy is being used. You likely don’t need it yourself

ZachDaniel:

You may need to use it when calling certain actions/changes

talha-azeem:

I am observing the register_form.ex and trying to change my registration live view like that.

talha-azeem:

strategy resource was getting used in get_params/2 i changed this function to get_params/1 and provided the resource manually. is this approach okay?

ZachDaniel:

I’m honestly not intimately familiar with that part of the code, but I’m sure its fine.

ZachDaniel:

Since the code is generic, you’ll probably end up replacing a lot of parts that reference something like strategy.resource with your own resource

ZachDaniel:

So the only thing you need that it doesn’t do right now is additional fields on register?

talha-azeem:

yes

ZachDaniel:

We can add that feature to ash_authentication_phoenix, if you can wait for it 🙂

ZachDaniel:

and then you don’t need to do all that work

talha-azeem:

<@197905764424089601> I will appreciate that. It will be a good feature to have. I am afraid I can’t wait tho. I have a deadline to meet. 😅

talha-azeem:

I am having one difference from the original registration form at the moment that if my password is not upto the mark then it empties the whole form and says fields are required.

ZachDaniel:

Hard to say whats wrong with that without seeing the implementation.

talha-azeem:

fixed it 😄

talha-azeem:

I am getting the hang of it

talha-azeem:

Thanks to you <@197905764424089601> 🙌

talha-azeem:

I really appreciate that you are helping me out.

talha-azeem:

just a single issue 😅

talha-azeem:

I am not getting the password confirmation field

ZachDaniel:

what do you mean by not getting?

talha-azeem:

like it is not getting rendered on the page.

ZachDaniel:

What does it look like?

ZachDaniel:

The code, I mean

talha-azeem:

my bad. I didn’t include it in the form 😅

talha-azeem:

😂

talha-azeem:

<@197905764424089601> How do we handle timestamps in ASH?

talha-azeem:

like normally they get entered automatically.

ZachDaniel:

attributes do
  timestamps()
end

talha-azeem:

yeah i added that

ZachDaniel:

That will add the timestamps automatically on create/update, is that not what you mean?

talha-azeem:

 ** (Postgrex.Error) ERROR 42703 (undefined_column) column "created_at" of relation "tokens" does not exist

    query: INSERT INTO "tokens" AS t0 ("created_at","expires_at","jti","purpose","subject","updated_at") VALUES ($1,$2,$3,$4,$5,$6) ON CONFLICT ("jti") DO UPDATE SET "updated_at" = $7, "expires_at" = $8, "jti" = $9, "purpose" = $10, "subject" = $11 RETURNING "jti","subject","expires_at","purpose","extra_data","created_at","updated_at"

talha-azeem:

got this.

ZachDaniel:

You need to generate migrations

talha-azeem:

while registration

talha-azeem:

yeah i already did that

talha-azeem:

migrated it as well

ZachDaniel:

Do you have the accounts api in config :your_app, ash_apis: [...] ?

talha-azeem:

oh, the db have the column inserted_at

talha-azeem:

yes

ZachDaniel:

How did you get it to look for :created_at ?

talha-azeem:

that i don’t know myself 😅

ZachDaniel:

Are you sure thats code coming from Ash?

ZachDaniel:

is there a stacktrace?

talha-azeem:

ZachDaniel:

Can I see your tokens resource?

talha-azeem:

defmodule Dummy.Accounts.Token do
  use Ash.Resource,
    data_layer: AshPostgres.DataLayer,
    extensions: [AshAuthentication.TokenResource]

  token do
    api Dummy.Accounts
  end

  postgres do
    table "tokens"
    repo Dummy.Repo
  end
end

talha-azeem:

Something was wrong with the DB i guess.

talha-azeem:

I dropped it. Recreated and migrated

talha-azeem:

It works now

ZachDaniel:

👍

ZachDaniel:

FWIW if you want timestamps on the tokens you’ll need to add it

talha-azeem:

tokens table have them by default

ZachDaniel:

oh, okay 👍

talha-azeem:

Closing this thread and opening a new one