class UsersController
Public Instance Methods
change_password()
click to toggle source
# File lib/generators/mindapp/templates/app/controllers/users_controller.rb, line 12 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()
click to toggle source
# File lib/generators/mindapp/templates/app/controllers/users_controller.rb, line 2 def index @today = Date.today @xmains = current_user.xmains.in(status:['R','I']).asc(:created_at) end
update_user()
click to toggle source
mindapp methods
# File lib/generators/mindapp/templates/app/controllers/users_controller.rb, line 8 def update_user # can't use session, current_user inside mindapp methods $user.update_attribute :email, $xvars["enter_user"]["user"]["email"] end