app/controllers/iugu/settings_controller.rb in iugusdk-1.0.0.alpha.26 vs app/controllers/iugu/settings_controller.rb in iugusdk-1.0.0.alpha.27
- old
+ new
@@ -1,8 +1,9 @@
class Iugu::SettingsController < ApplicationController
before_filter :authenticate_user!, :except => :add_social
+ before_filter :verify_token
layout IuguSDK.default_layout
def index
redirect_to :profile_settings, :notice => flash[:notice]
@@ -18,8 +19,16 @@
end
else
access = true if @account_user.is?(roles)
end
raise ActionController::RoutingError.new("Access Denied") if access == false
+ end
+
+ private
+
+ def verify_token
+ if IuguSDK::enable_user_api and current_user
+ current_user.send(:init_token) unless current_user.token
+ end
end
end