Class: AccountsController
Instance Method Summary
collapse
#dispatch, #get_locales, #is_dcmgr?, #set_application, #set_locale
Instance Method Details
#index ⇒ Object
12
13
14
|
# File 'app/controllers/accounts_controller.rb', line 12
def index
end
|
#password ⇒ Object
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?
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
|
#switch ⇒ Object
2
3
4
5
6
7
8
9
10
|
# File 'app/controllers/accounts_controller.rb', line 2
def switch
account_uuid = params[:accounts][:account_uuid]
user = User.find(:uuid => @current_user.uuid)
user.primary_account_id = account_uuid
user.save
redirect_to :root
end
|
#update_settings ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/accounts_controller.rb', line 16
def update_settings
account = params[:account]
if account
setting_params = {
:time_zone => account[:time_zone],
:locale => account[:locale],
}
User.update_settings(@current_user.id, setting_params)
end
redirect_to :action => 'index'
end
|