-
Notifications
You must be signed in to change notification settings - Fork 2
Add forgot password link and flow #560
Conversation
|
@kagure-nyakio, let's see how this works in a newly created Ash app. sh <(curl 'https://ash-hq.org/new/self_driving_lawn_mower?install=phoenix') \
&& cd self_driving_lawn_mower && mix igniter.install ash_phoenix \
ash_postgres ash_authentication ash_authentication_phoenix \
--auth-strategy password --yes && mix ash.setupwhich I ran, then started the Phoenix server. After registering at http://localhost:4000/register, I was able to reset the password. Looking at the generated resources, For example, actions do
create :store_token do
description "Stores a token used for the provided purpose."
accept [:extra_data, :purpose]
argument :token, :string, allow_nil?: false, sensitive?: true
change AshAuthentication.TokenResource.StoreTokenChange
end
authentication do
tokens do
enabled? true
token_resource SelfDrivingLawnMower.Accounts.Token
signing_secret SelfDrivingLawnMower.Secrets
store_all_tokens? true
end
strategies do
password :password do
identity_field :email
resettable do
sender SelfDrivingLawnMower.Accounts.User.Senders.SendPasswordResetEmail
# these configurations will be the default in a future release
password_reset_action_name :reset_password_with_token
request_password_reset_action_name :request_password_reset_token
end
end
end
end
actions do
action :request_password_reset_token do
description "Send password reset instructions to a user if they exist."
argument :email, :ci_string do
allow_nil? false
end
# creates a reset token and invokes the relevant senders
run {AshAuthentication.Strategy.Password.RequestPasswordReset, action: :get_by_email}
end
endCheck if there are other missing parts. |
|
Can we try Jim's solutions? |
|
@almirsarajcic, both suggestions don't work. I get a token but it is an invalid one. Can we just keep the test for the sad path for now and test out the happy path later? |
|
Let's meet tomorrow. Maybe we need to encrypt/decrypt the value we get there. |
almirsarajcic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
A few minor issues, though.
|
@almirsarajcic, made some changes. |




Fixes #535
Still pending: