-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Add change password on Me::Show page
This doesn't pass consistently. I think the problem is that the form some how isn't loading and selenium is not able to wait for one of the form fields. The result is it fills out the password_confirmation, but not the password field.
- Loading branch information
1 parent
177b891
commit b71f879
Showing
7 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Me::Show < BrowserAction | ||
get "/me" do | ||
render ShowPage, bits: BitQuery.from(current_user) | ||
render ShowPage, form: PasswordResetForm.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Users::UpdatePassword < BrowserAction | ||
include Auth::PasswordResets::FindUser | ||
|
||
post "/users/:user_id/password_update" do | ||
PasswordResetForm.update(user, params) do |form, user| | ||
if form.saved? | ||
flash.success = "Your password has been updated" | ||
redirect to: Me::Show | ||
else | ||
puts params.to_h | ||
puts form.errors | ||
render Me::ShowPage, form: form | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
class Me::ShowPage < MainLayout | ||
needs form : PasswordResetForm | ||
|
||
def content | ||
h3 "#{@current_user.username}" | ||
|
||
render_password_reset_form(@form) | ||
end | ||
|
||
private def render_password_reset_form(form) | ||
form_for Users::UpdatePassword.with(@current_user.id) do | ||
field(form.password) { |i| password_input i, autofocus: "true" } | ||
field(form.password_confirmation) { |i| password_input i } | ||
|
||
submit "Update Password", flow_id: "update-password-button" | ||
end | ||
end | ||
end |