<p>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 <a href="https://github.com/heartcombo/devise">Devise</a> for some of the user-related features.</p>
<p>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 <a href="https://github.com/heartcombo/devise/tree/master/app/controllers/devise">following Devise controller naming conventions</a> will make things easier down the road.</p>
<p>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.</p>
<p>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.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/3147'>https://github.com/openstreetmap/openstreetmap-website/pull/3147</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Refactor login/logout into sessions controller</li>
  <li>Move sessions-related tests out of UsersControllerTest</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-29beaabe278fd17493296745cecb67919f0906b47b8246ab770f5517615d9ef7">.rubocop_todo.yml</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-debf59904131dc89a88ab44cbb1d6deaaa5a7d70c0507f674080df62f7c8e41f">app/abilities/ability.rb</a>
    (3)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-8ac25145a80d1093fb7a8f1098aa9d5b0a1d70ced7333342a9ec569227d0a82f">app/controllers/concerns/session_methods.rb</a>
    (98)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-cdec550eeeb8fc63be2b5687170f594651a8d0b7f0465c9d807baef392639b6e">app/controllers/sessions_controller.rb</a>
    (59)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-cfdccd0a9d5df5a43aaad2a35d36ebbe187c52ad5fdc9846fa189d04537adb6e">app/controllers/users_controller.rb</a>
    (134)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-b4fc005393d27baeb208c32dfc3bd576364fa35e6d76a69ea8b99da62616f80e">app/helpers/user_helper.rb</a>
    (6)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-5854428b7cc485561dc03d0c2518ae13bd8ac6165acbe19e54bd08a1561c409c">app/views/sessions/destroy.html.erb</a>
    (0)
  </li>
  <li>
    <strong>R</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-5654cfc158c888a40321c1e90f9ea3a0208ae80616b15ff0fa5e939b8f795e87">app/views/sessions/new.html.erb</a>
    (0)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-44438ce218f5287c58d0017f965d888715635d94280669896f75841fbd7b4cd7">config/locales/en.yml</a>
    (105)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-959bc9abc46a55332bb64d5155a79323afa75a50ec1a2137ddd22d926f62c6c5">config/routes.rb</a>
    (5)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-0ebf4c65ae927de1d02650f4caa7f2810e14eb64201b7570cb30939f0ee38719">test/controllers/sessions_controller_test.rb</a>
    (90)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-2719d3c650da3c587f727ca3c105e6bc93a7113f85717bb15983543cf4f85ae5">test/controllers/users_controller_test.rb</a>
    (83)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-61df78335fb0a8542698c24b6fb46b1f5e144e6c207382c2713abb64f97b05f8">test/integration/user_changeset_comments_test.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-17e29600ff1f9545e4460fbe6a061b81327a65d7390a631b98ae36c506c59679">test/integration/user_diaries_test.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-c01b7ed27f3565249b8271e0cadf4f76775b4dfe17d692da655e838150f5c497">test/integration/user_login_test.rb</a>
    (94)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-5282e62ded5f4eeb7cedcc9637a0877d488ea1559fce342df79cf2c60e7dbe57">test/integration/user_terms_seen_test.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147/files#diff-1937855845d794c2ab6ec4812a8b4e3230c470b69ff763285bdd810915042839">test/system/issues_test.rb</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3147.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/3147.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3147.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/3147.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3147">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLOJQVMQKIKWVVIP3TDTFHTA3ANCNFSM4ZXIWR5A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLOXLMACTJEBLCNXUPLTFHTA3A5CNFSM4ZXIWR5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MQNIRMA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3147",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3147",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>