Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- UsersController
- Defined in:
- lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb
Instance Method Summary collapse
- #change_password ⇒ Object
- #index ⇒ Object
- #send_password_reset ⇒ Object
-
#update_user ⇒ Object
jinda methods.
Methods inherited from ApplicationController
Instance Method Details
#change_password ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb', line 16 def change_password # check if old password correct identity = Identity.find_by code: $user.code if identity.authenticate($xvars['enter']['epass']) identity.password = $xvars['enter']['npass'] identity.password_confirmation = $xvars['enter']['npass_confirm'] identity.save ma_log 'Password changed' else ma_log 'Unauthorized access' end end |
#index ⇒ Object
4 5 6 7 |
# File 'lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb', line 4 def index @today = Time.zone.today @xmains = current_ma_user.xmains.in(status: %w[R I]).asc(:created_at) end |
#send_password_reset ⇒ Object
29 30 31 32 33 34 |
# File 'lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb', line 29 def send_password_reset generate_token(:password_reset_token) self.password_reset_sent_at = Time.zone.now save! UserMailer.password_reset(self).deliver end |
#update_user ⇒ Object
jinda methods
10 11 12 13 14 |
# File 'lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb', line 10 def update_user # can't use session, current_ma_user inside jinda methods $user.update_attribute :email, $xvars['enter_user']['user']['email'] $user.update_attribute :image, $xvars['enter_user']['user']['image'] end |