lib/devise_phone/controllers/helpers.rb in devise_phone-0.0.17 vs lib/devise_phone/controllers/helpers.rb in devise_phone-0.0.161
- old
+ new
@@ -1,9 +1,18 @@
module DevisePhone::Controllers::Helpers
+ protected
+
+ # Convenience helper to check if user has confirmed the token (and the phone) or not.
+ def require_sms_activated!
+ if(send(:"authenticate_#{resource_name}!"))
+ res=send(:"current_#{resource_name}")
+ fail!(:sms_activation_required) if (!res) || (!res.sms_confirmed?)
+ end
+ end
end
ActionController::Base.send :include, DevisePhone::Controllers::Helpers
\ No newline at end of file