Module: Passconf::ApplicationHelper
- Defined in:
- app/helpers/passconf/application_helper.rb
Instance Method Summary collapse
Instance Method Details
#check_password_status ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/passconf/application_helper.rb', line 3 def check_password_status if current_user @req_controller = params[:controller] @password_status = current_user.send("password_status_#{@req_controller }") if current_user.respond_to?("password_status_#{@req_controller }") unless @password_status redirect_to root_path, notice: "You did not authorize password authentication." end end end |
#reset_password_status ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/passconf/application_helper.rb', line 14 def reset_password_status if current_user req_controller = params[:controller] user_columns = User.columns.collect(&:name).select{|i| i =~ /password_status_/} user_columns.each do |element| unless element == req_controller && current_user.send(element) current_user.update_attribute(element, false) end end end end |