diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6435a03d8..23731e2c0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -15,6 +15,10 @@ class UsersController < ApplicationController User.create!(user_params) end + def edit_password + render :edit_password + end + private def user_params diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/users/edit_password.html.erb similarity index 87% rename from app/views/devise/passwords/edit.html.erb rename to app/views/users/edit_password.html.erb index abbd8b4b5..f753a0223 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/users/edit_password.html.erb @@ -5,7 +5,7 @@ ) %> <% end %> -<%= form_for(current_user, as: :user, url: account_update_path(), html: { method: :patch }) do |f| %> +<%= form_for(current_user, as: :user, url: password_path(:user), html: { method: :patch }) do |f| %>

Change your password

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c9988446e..e90d35cdc 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -23,7 +23,7 @@ <%= summary_list.row do |row| row.key { 'Password' } row.value { '••••••••' } - row.action(visually_hidden_text: 'password', href: edit_user_password_path, html_attributes: { 'data-qa': 'change-password' }) + row.action(visually_hidden_text: 'password', href: password_edit_user_path, html_attributes: { 'data-qa': 'change-password' }) end %> <%= summary_list.row do |row| diff --git a/config/routes.rb b/config/routes.rb index 095e5ff87..c7be56592 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,11 @@ Rails.application.routes.draw do root to: "test#index" get "about", to: "about#index" - resources :users + resources :users do + member do + get "password/edit", to: "users#edit_password" + end + end resources :organisations do member do