lib/gds-sso/controller_methods.rb in gds-sso-2.0.1 vs lib/gds-sso/controller_methods.rb in gds-sso-2.1.0

- old
+ new

@@ -29,19 +29,23 @@ skip_slimmer render "authorisations/cant_signin", layout: "unauthorised", status: :forbidden end def authenticate_user! - if current_user && current_user.remotely_signed_out? + if user_remotely_signed_out? message = "You have been remotely signed out." skip_slimmer render "authorisations/unauthorised", layout: "unauthorised", status: :forbidden, locals: { message: message } end warden.authenticate! end + def user_remotely_signed_out? + warden.authenticated? && warden.user.remotely_signed_out? + end + def user_signed_in? - warden.authenticated? + warden.authenticated? && ! warden.user.remotely_signed_out? end def current_user warden.user if user_signed_in? end