<h3 dir="auto">Description</h3>
<p dir="auto">Draft PR for a restful refactor of the confirmations controller. The original intention here was for a purely structural set of changes that otherwise preserved existing functionality. However, moving toward a more restful structure prompted reusing the <code class="notranslate">#show</code> endpoint for both confirmation scenarios, which in turn introduced a few changes in behavior.</p>
<p dir="auto">I am looking for some initial feedback that this is going in an acceptable direction. I am of course happy to break this out into smaller PRs.</p>
<p dir="auto">Changes:</p>
<ul dir="auto">
<li>Introduce restful routes for confirmations controller</li>
<li>Deprecate <code class="notranslate">new_user</code> and <code class="notranslate">new_email</code> tokens in favor of single <code class="notranslate">account_confirmation</code> token</li>
<li>Some UI changes around confirmation and error messages</li>
</ul>
<p dir="auto">Remaining work:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Fix failing tests</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Add more test coverage</li>
</ul>
<h3 dir="auto">How has this been tested?</h3>
<p dir="auto">I've gone through both of the new account and email change confirmation flows locally. I've also tested out the scenarios where confirmation emails are sent out with the currently deployed token generation logic but are handled by the code in this PR.</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/5895'>https://github.com/openstreetmap/openstreetmap-website/pull/5895</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/7155ae93a4463e333ee261a1b55c4380cda77b5c" class="commit-link">7155ae9</a>  Move controller methods to user model</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/77d82e64fe9352690452d6badca724c41891a42f" class="commit-link">77d82e6</a>  Add restful routes</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/460fff5fe2437d9dc10d01fa721f3c109828df1f" class="commit-link">460fff5</a>  Make controller restful</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/20c360bfb8574814af2aa446f17214cdcf593a12" class="commit-link">20c360b</a>  Update route invocations</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/2d6d54e2f6ecdce947ddbefacdb9af00c207d51f" class="commit-link">2d6d54e</a>  Centralize token usage</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/6c92b52ac779bfb0612782c98c73dbdc4acea73d" class="commit-link">6c92b52</a>  Update views</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/2454633f74743a074deeb3a3e804994368f0f8aa" class="commit-link">2454633</a>  Update abilities</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/19c7eccd3ed10935c49cb4b75561f1864f28d69d" class="commit-link">19c7ecc</a>  Update strings</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/3fd71318ad7739dc5f2abe450c86ee13644b19e9" class="commit-link">3fd7131</a>  Get tests passing</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/commits/fd49e7816068e3cbc8267630a5bd63eb23f77375" class="commit-link">fd49e78</a>  Fix a couple of bugs</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files">13 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-debf59904131dc89a88ab44cbb1d6deaaa5a7d70c0507f674080df62f7c8e41f">app/abilities/ability.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-8ac25145a80d1093fb7a8f1098aa9d5b0a1d70ced7333342a9ec569227d0a82f">app/controllers/concerns/session_methods.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-7aef2ace328700051fb00c64431397ca324c650157bf5ddab585023b4e8652d5">app/controllers/concerns/user_methods.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-961c5d7e0310073ca00d502eda2687808102441be660a654cab29645fbcea019">app/controllers/confirmations_controller.rb</a>
    (111)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-cfdccd0a9d5df5a43aaad2a35d36ebbe187c52ad5fdc9846fa189d04537adb6e">app/controllers/users_controller.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-55254045ba774e4c360d7bbfde054665072d2ab49abc3f21add15a37bba65a1c">app/mailers/user_mailer.rb</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-9802ca3c9c4cf89904fd44bc114e35ebdf2c5dd3d5b645491e2b253e1afef29b">app/models/user.rb</a>
    (55)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-596485415afaa248c73d36eeb3a5be71b78f19acaedd02fd5dbf9bad11145d18">app/views/confirmations/confirm.html.erb</a>
    (36)
  </li>
  <li>
    <strong>D</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-602689469c36018a5a0d7ecb5da2e2cf10694ed88b3ad50817d4b9a36448298d">app/views/confirmations/confirm_email.html.erb</a>
    (16)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-61ea58e413fd1033102cc7b3b1433207d8ad94b5592f47a7b7d13d444d692b15">app/views/confirmations/new.html.erb</a>
    (20)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-44438ce218f5287c58d0017f965d888715635d94280669896f75841fbd7b4cd7">config/locales/en.yml</a>
    (16)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-959bc9abc46a55332bb64d5155a79323afa75a50ec1a2137ddd22d926f62c6c5">config/routes.rb</a>
    (13)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5895/files#diff-0d2e03e45f001516dac5c734d8c0cdbff7a73028598ed5d2f9f8623e52c6099e">test/controllers/confirmations_controller_test.rb</a>
    (152)
  </li>
</ul>

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

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