Class: Faalis::Dashboard::ProfileController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Faalis::Dashboard::ProfileController
- Defined in:
- app/controllers/faalis/dashboard/profile_controller.rb
Instance Method Summary collapse
-
#edit_password ⇒ Object
GET /sites/new.
- #resource_params ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
- #update_password ⇒ Object
Instance Method Details
#edit_password ⇒ Object
GET /sites/new
26 27 28 29 |
# File 'app/controllers/faalis/dashboard/profile_controller.rb', line 26 def edit_password @user = ::Faalis::User.find(current_user.id) @user end |
#resource_params ⇒ Object
46 47 48 |
# File 'app/controllers/faalis/dashboard/profile_controller.rb', line 46 def resource_params params.require(:user).permit(:password, :current_password, :password_confirmation, :first_name, :last_name, :email) end |
#show ⇒ Object
3 4 5 6 |
# File 'app/controllers/faalis/dashboard/profile_controller.rb', line 3 def show @user = current_user respond_with(@user) end |
#update ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/faalis/dashboard/profile_controller.rb', line 8 def update @user = ::Faalis::User.find(current_user.id) @user respond_to do |f| if @user.update_without_password(resource_params) f.js { } f.html { } else @errors = @user.errors f.js {render :errors} f.html end end end |
#update_password ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/faalis/dashboard/profile_controller.rb', line 31 def update_password @user = ::Faalis::User.find(current_user.id) @user respond_to do |f| if @user.update_with_password(resource_params) f.js { redirect_to new_user_session_path } f.html { redirect_to new_user_session_path } else @errors = @user.errors f.js {render :errors} f.html end end end |