Note that there are some explanatory texts on larger screens.

plurals
  1. POForbiddenAttributesError, Devise
    primarykey
    data
    text
    <p>I allow users to login using Facebook and Google using OmniAuth, also I allow them to create accounts using their emails. Everything is working fine except for the part in which the users are able to update their account information. </p> <p>I added a field called username, in which the sign_up and sign_in handles Ok, for the update I don't want to require the user enter password if he is signed in using facebook but I keep getting ForbiddenAttributesError.</p> <p>here is the code I wrote. </p> <pre><code>class Users::RegistrationsController &lt; Devise::RegistrationsController before_filter :configure_permitted_parameters, if: :devise_controller? def update @provider = Provider.find_by_user_id(current_user.id) @user = User.find(current_user.id) email_changed = current_user.email != params[resource_name][:email] is_omniauth_account = @provider.blank? successfully_updated = if is_omniauth_account resource.update_with_password(params[resource_name]) else resource.update_without_password(params[resource_name]) end if successfully_updated # Sign in the user bypassing validation in case his password changed sign_in @user, :bypass =&gt; true redirect_to root_path else clean_up_passwords(resource) render_with_scope :edit end end protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation) } devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) } devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password) } end def resource_params params.require(:user).permit(:username, :email, :password, :password_confirmation, :current_password) end private :resource_params end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload