2016-11-15 15:56:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-05 21:43:05 +00:00
|
|
|
class Auth::SessionsController < Devise::SessionsController
|
2016-03-27 23:06:52 +01:00
|
|
|
include Devise::Controllers::Rememberable
|
|
|
|
|
2016-03-05 21:43:05 +00:00
|
|
|
layout 'auth'
|
2016-03-27 23:06:52 +01:00
|
|
|
|
2017-01-27 19:28:46 +00:00
|
|
|
before_action :configure_sign_in_params, only: [:create]
|
|
|
|
|
2016-03-27 23:06:52 +01:00
|
|
|
def create
|
|
|
|
super do |resource|
|
|
|
|
remember_me(resource)
|
|
|
|
end
|
|
|
|
end
|
2016-09-26 22:55:21 +01:00
|
|
|
|
|
|
|
protected
|
|
|
|
|
2017-01-27 19:28:46 +00:00
|
|
|
def configure_sign_in_params
|
|
|
|
devise_parameter_sanitizer.permit(:sign_in, keys: [:otp_attempt])
|
|
|
|
end
|
|
|
|
|
2016-09-26 22:55:21 +01:00
|
|
|
def after_sign_in_path_for(_resource)
|
2016-10-03 15:38:22 +01:00
|
|
|
last_url = stored_location_for(:user)
|
|
|
|
|
|
|
|
if [about_path].include?(last_url)
|
|
|
|
root_path
|
|
|
|
else
|
|
|
|
last_url || root_path
|
|
|
|
end
|
2016-09-26 22:55:21 +01:00
|
|
|
end
|
2016-03-05 21:43:05 +00:00
|
|
|
end
|