implementing custom register form
I was looking into the register_form.ex and found a key @strategy. What is it used for?
31 Replies
The strategy is the configuration for which authentication strategy is being used. You likely don't need it yourself
You may need to use it when calling certain actions/changes
I am observing the register_form.ex and trying to change my registration live view like that.
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?I'm honestly not intimately familiar with that part of the code, but I'm sure its fine.
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
So the only thing you need that it doesn't do right now is additional fields on register?yes
We can add that feature to ash_authentication_phoenix, if you can wait for it š
and then you don't need to do all that work
@Zach Daniel 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. š
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.
Hard to say whats wrong with that without seeing the implementation.
fixed it š
I am getting the hang of it
Thanks to you @Zach Daniel š
I really appreciate that you are helping me out.
just a single issue š
I am not getting the password confirmation field
what do you mean by not getting?
like it is not getting rendered on the page.
What does it look like?
The code, I mean
my bad. I didn't include it in the form š
š
@Zach Daniel How do we handle timestamps in ASH?
like normally they get entered automatically.
yeah i added that
That will add the timestamps automatically on create/update, is that not what you mean?
got this.
You need to generate migrations
while registration
yeah i already did that
migrated it as well
Do you have the accounts api in
config :your_app, ash_apis: [...]
?oh, the db have the column
inserted_at

yes
How did you get it to look for
:created_at
?that i don't know myself š
Are you sure thats code coming from Ash?
is there a stacktrace?
Can I see your tokens resource?
Something was wrong with the DB i guess.
I dropped it. Recreated and migrated
It works now
š
FWIW if you want timestamps on the tokens you'll need to add it
tokens table have them by default
oh, okay š
Closing this thread and opening a new one