Browse Source

Password edit path

pull/134/head
baarkerlounger 4 years ago committed by Paul Robert Lloyd
parent
commit
5d6a19dbff
  1. 4
      app/controllers/users_controller.rb
  2. 2
      app/views/users/edit_password.html.erb
  3. 2
      app/views/users/show.html.erb
  4. 6
      config/routes.rb

4
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

2
app/views/devise/passwords/edit.html.erb → 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| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Change your password</h1>

2
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|

6
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

Loading…
Cancel
Save