app/controllers/adminpanel/sessions_controller.rb in adminpanel-2.2.5 vs app/controllers/adminpanel/sessions_controller.rb in adminpanel-2.3.0
- old
+ new
@@ -2,22 +2,22 @@
class SessionsController < ActionController::Base
include SessionsHelper
include ApplicationHelper
protect_from_forgery
- layout 'admin-login'
+ layout 'adminpanel/application-login'
before_action :configure_instagram, only:[:instagram_login, :instagram_callback]
def new
end
def create
user = User.find_by_email(params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
sign_in user
flash[:success] = I18n.t('authentication.signin_success')
- permission = user.rol.permissions.first
+ permission = user.role.permissions.first
if permission.nil?
redirect_to root_url
else
redirect_to [route_symbol(permission.resource)]
end
@@ -32,15 +32,16 @@
redirect_to signin_path
end
def twitter_callback
save_twitter_tokens
+ Rails.cache.clear
flash[:success] = I18n.t('twitter.saved_token')
redirect_to twitter_analytics_path
end
def instagram_login
- redirect_to Instagram.authorize_url(:redirect_uri => instagram_callback_sessions_url, :scope => 'comments')
+ redirect_to Instagram.authorize_url(redirect_uri: instagram_callback_sessions_url, scope: 'comments')
end
def instagram_callback
response = Instagram.get_access_token(params[:code], :redirect_uri => instagram_callback_sessions_url)
username = Instagram.client(access_token: response.access_token).user.username