From: Tom Hughes Date: Thu, 27 Jul 2017 18:40:20 +0000 (+0100) Subject: Change user forms to use current user instead of @user X-Git-Tag: live~3313^2~1 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/24fc94944bc62de99ddf5ad81ed2598cc0d72680 Change user forms to use current user instead of @user --- diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index ea6e1a8d5..d3ed53c1b 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -220,6 +220,8 @@ class UserController < ApplicationController flash.now[:notice] = render_to_string :partial => "auth_association" else check_signup_allowed + + self.current_user = User.new end end diff --git a/app/views/user/account.html.erb b/app/views/user/account.html.erb index ab74e3780..2e7f68d9d 100644 --- a/app/views/user/account.html.erb +++ b/app/views/user/account.html.erb @@ -10,8 +10,8 @@ <% end %> -<%= error_messages_for 'user' %> -<%= form_for :user, :html => { :multipart => true, :id => 'accountForm', :class => 'standard-form', :autocomplete => :off } do |f| %> +<%= error_messages_for current_user %> +<%= form_for current_user, :html => { :multipart => true, :id => 'accountForm', :class => 'standard-form', :autocomplete => :off } do |f| %>
@@ -92,7 +92,7 @@
- <%= richtext_area :user, :description, :cols => 80, :rows => 20 %> + <%= richtext_area :user, :description, :object => current_user, :cols => 80, :rows => 20 %>
diff --git a/app/views/user/new.html.erb b/app/views/user/new.html.erb index fcd775a48..5a207060e 100644 --- a/app/views/user/new.html.erb +++ b/app/views/user/new.html.erb @@ -8,7 +8,7 @@
<% end %> -<%= form_for :user, :url => { :action => 'create' }, :html => { :class => 'standard-form fillL col6 inner22' } do %> +<%= form_for current_user, :url => { :action => 'create' }, :html => { :class => 'standard-form fillL col6 inner22' } do |f| %> <%= hidden_field_tag('referer', h(@referer)) unless @referer.nil? %>
@@ -16,15 +16,15 @@ - <%= email_field(:user, :email, { :tabindex => 1 }) %> - <%= error_message_on(:user, :email) %> + <%= f.email_field(:email, { :tabindex => 1 }) %> + <%= f.error_message_on(:email) %>
- <%= email_field(:user, :email_confirmation, { :tabindex => 2 }) %> - <%= error_message_on(:user, :email_confirmation) %> + <%= f.email_field(:email_confirmation, { :tabindex => 2 }) %> + <%= f.error_message_on(:email_confirmation) %>
<%= raw(t 'user.new.not displayed publicly') %>
@@ -34,8 +34,8 @@ - <%= text_field(:user, :display_name, { :tabindex => 3 }) %> - <%= error_message_on(:user, :display_name) %> + <%= f.text_field(:display_name, { :tabindex => 3 }) %> + <%= f.error_message_on(:display_name) %>
<%= t 'user.new.display name description' %>
@@ -45,9 +45,9 @@ - <%= select(:user, :auth_provider, Auth::PROVIDERS, { :default => "", :tabindex => 4 }) %> - <%= text_field(:user, :auth_uid, { :tabindex => 5 }) %> - <%= error_message_on(:user, :auth_uid) %> + <%= f.select(:auth_provider, Auth::PROVIDERS, { :default => "", :tabindex => 4 }) %> + <%= f.text_field(:auth_uid, { :tabindex => 5 }) %> + <%= f.error_message_on(:auth_uid) %> <%= t 'user.new.auth no password' %> @@ -57,15 +57,15 @@ - <%= password_field(:user, :pass_crypt, { :tabindex => 6 }) %> - <%= error_message_on(:user, :pass_crypt) %> + <%= f.password_field(:pass_crypt, { :tabindex => 6 }) %> + <%= f.error_message_on(:pass_crypt) %>
- <%= password_field(:user, :pass_crypt_confirmation, { :tabindex => 7 }) %> - <%= error_message_on(:user, :pass_crypt_confirmation) %> + <%= f.password_field(:pass_crypt_confirmation, { :tabindex => 7 }) %> + <%= f.error_message_on(:pass_crypt_confirmation) %>