[openstreetmap/openstreetmap-website] Create a SessionsController (#3147)
notifications at github.com
Wed Mar 24 13:35:09 UTC 2021
UsersController is quite complex, and so I would like to split it up into different controllers. This also allows us to (more easily) move to standard new/create/edit/update methods, as well as simplifying our largest controller. We also have a long-time desire to move towards using [Devise](https://github.com/heartcombo/devise) for some of the user-related features.
This PR moves the login/logout functionality to a new SessionsController. This is modelled on the Devise SessionsController. There are many ways that we could split up UsersController but I think [following Devise controller naming conventions](https://github.com/heartcombo/devise/tree/master/app/controllers/devise) will make things easier down the road.
Unfortunately a bunch of utility methods from UsersController are also used by the oauth methods, so either need to be duplicated, or (as I've done here) moved to a concern to be shared between the two controllers. Perhaps future refactoring will simplify this further.
I split moving tests into a new file into a separate commit, so that it's one commit that has the test changes, and a second commit that simply moves them, rather than mixing together changes and moves into the same diff.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* Refactor login/logout into sessions controller
* Move sessions-related tests out of UsersControllerTest
-- File Changes --
M .rubocop_todo.yml (1)
M app/abilities/ability.rb (3)
A app/controllers/concerns/session_methods.rb (98)
A app/controllers/sessions_controller.rb (59)
M app/controllers/users_controller.rb (134)
M app/helpers/user_helper.rb (6)
R app/views/sessions/destroy.html.erb (0)
R app/views/sessions/new.html.erb (0)
M config/locales/en.yml (105)
M config/routes.rb (5)
A test/controllers/sessions_controller_test.rb (90)
M test/controllers/users_controller_test.rb (83)
M test/integration/user_changeset_comments_test.rb (2)
M test/integration/user_diaries_test.rb (2)
M test/integration/user_login_test.rb (94)
M test/integration/user_terms_seen_test.rb (4)
M test/system/issues_test.rb (2)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rails-dev