Skip to content

[refactor] split agents and users sessions controller + active_for_auth

Vincent Agnano requested to merge refactor/sessions-controllers into master

Created by: adipasquale

preliminary refactors for France Connect #752

split agents and users sessions controller

  • will allow divergent views (one with FC button the other not)
  • slightly simplifies code branching in views (ie no footer links for agents , we could go further)
  • simplify and improve sign_out_other_scope method. it's role is to sign out the connecting resource from other roles so for example if you're already logged as an agent but try to login as a user, it should automatically log you out. However it currently behaves very weirdly because you're redirected to the agents sign in page with a warning right after logging in as a user. I've changed the method so that it simply prevents logging while you're logged in with another scope. I could also simplify it because it's now split controllers

simplify user#active_for_authentication

I removed && !encrypted_password.blank? from this check because it would be preventing future FC users to login (they won't have a password). I did double check and I don't think it breaks any existing behaviour to simply remove this.

i tested this usecase :

  • an agent invites a user
  • the user misses the invitation mail and never clicks on it
  • the user tries to login or signup independently with the same email

I think that the behaviour is strictly unchanged : to double check

Merge request reports