profile_controller.rb 795 Bytes
Newer Older
gitlabhq's avatar
gitlabhq committed
1
class ProfileController < ApplicationController
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
2 3
  before_filter :user

gitlabhq's avatar
gitlabhq committed
4 5 6
  def show
  end

7 8 9 10
  def design
  end

  def update
11
    @user.update_attributes(params[:user])
12
    redirect_to :back
13 14
  end

15 16 17
  def token
  end

gitlabhq's avatar
gitlabhq committed
18
  def password_update
Nihad Abbasov's avatar
Nihad Abbasov committed
19
    params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
gitlabhq's avatar
gitlabhq committed
20 21 22 23 24

    if @user.update_attributes(params[:user])
      flash[:notice] = "Password was successfully updated. Please login with it"
      redirect_to new_user_session_path
    else
25
      render 'account'
gitlabhq's avatar
gitlabhq committed
26 27
    end
  end
28 29 30

  def reset_private_token
    current_user.reset_authentication_token!
31
    redirect_to profile_account_path
32
  end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
33

34 35 36 37 38
  def history
    @events = current_user.recent_events.page(params[:page]).per(20)
  end

  private
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
39 40 41 42

  def user
    @user = current_user
  end
gitlabhq's avatar
gitlabhq committed
43
end