Class: AccountsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/accounts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#dispatch, #get_locales, #is_dcmgr?, #set_application, #set_locale

Instance Method Details

#indexObject



12
13
14
# File 'app/controllers/accounts_controller.rb', line 12

def index

end

#passwordObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/accounts_controller.rb', line 30

def password
  @error_message = ''
  if request.get?
    #nop
  elsif request.post?
    password =  params[:password]
    new_password = params[:new_password]
    confirm_password = params[:confirm_password]
    unless new_password == confirm_password
      @error_message = I18n.t('error_message.change_password1')
      return true 
    end

    user = User.find(:uuid => @current_user.uuid, :password => User.encrypt_password(password))
    if user
      user.password = User.encrypt_password(new_password)
      user.save
      redirect_to :action => 'index'
    else
      @error_message = I18n.t('error_message.change_password2')
    end
  end
end

#switchObject



2
3
4
5
6
7
8
9
10
# File 'app/controllers/accounts_controller.rb', line 2

def switch
   = params[:accounts][:account_uuid]

  user = User.find(:uuid => @current_user.uuid)
  user. = 
  user.save

  redirect_to :root
end

#update_settingsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/accounts_controller.rb', line 16

def update_settings
   = params[:account]
  if 
    
    setting_params = {
      :time_zone => [:time_zone],
      :locale => [:locale],
    }

    User.update_settings(@current_user.id, setting_params)
  end
  redirect_to :action => 'index'
end