Module: DmCore::Concerns::ProfileController

Extended by:
ActiveSupport::Concern
Includes:
PermittedParams
Included in:
ProfileController
Defined in:
app/controllers/dm_core/concerns/profile_controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from PermittedParams

#account_params, #comment_params, #devise_sign_up_params, #user_params, #user_profile_direct_params, #user_profile_params

Instance Method Details

#accountObject




12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/dm_core/concerns/profile_controller.rb', line 12

def 
  @user = current_user
  if put_or_post?
    if @user.update_with_password(user_params)
      #--- Sign in the user bypassing validation in case his password changed
       @user, :bypass => true
      if params[:user][:email] != @user.email
        flash.now[:notice] = I18n.t('core.profile_email_confirmation')
      else
        flash.now[:notice] = I18n.t('core.profile_password_updated')
      end
    end
  end
end

#detailsObject




28
29
30
31
32
33
34
35
# File 'app/controllers/dm_core/concerns/profile_controller.rb', line 28

def details
  @user_profile = current_user.
  if put_or_post?
    if @user_profile.update_attributes()
      flash.now[:notice] = I18n.t('core.profile_profile_updated')
    end
  end
end