From 0bde9d2812d54a222bb9f3196ac95087d04cd44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Mon, 11 Oct 2021 01:52:16 +0200 Subject: [PATCH] account update --- app/controllers/users/registrations_controller.rb | 6 +++++- app/views/devise/registrations/edit.html.erb | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 0fd4b4e0b..85f5f2338 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,6 +1,7 @@ class Users::RegistrationsController < Devise::RegistrationsController prepend_before_action :set_university, only: :create before_action :configure_sign_up_params, only: :create + before_action :configure_account_update_params, only: :update protected @@ -9,8 +10,11 @@ class Users::RegistrationsController < Devise::RegistrationsController request.params[:user][:university_id] = current_university.id end - # If you have extra params to permit, append them to the sanitizer. def configure_sign_up_params devise_parameter_sanitizer.permit(:sign_up, keys: [:language_id]) end + + def configure_account_update_params + devise_parameter_sanitizer.permit(:account_update, keys: [:mobile_phone, :language_id]) + end end diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index cc11aefc3..ea86eb746 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -10,6 +10,9 @@ <p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p> <% end %> + <%= f.input :mobile_phone %> + <%= f.association :language, include_blank: false %> + <%= f.input :password, hint: "leave it blank if you don't want to change it", required: false, -- GitLab