Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add has_unconfirmed_email attribute, to be used in the account home page #117

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

barrucadu
Copy link
Contributor

This is not just !email_verified:

  • email - this is the email address the user registered with, or a
    new email address they have confirmed.

  • email_verified - the user needs to verify the email address they
    registered with, this starts false, becomes true, and then never
    returns to false

  • has_unconfirmed_email - this is true if email_verified is
    false OR the user has a pending email change to confirm

So,

if has_unconfirmed_email
  if email_verified
    show "finish changing your email address" banner
  else
    show "confirm your account" banner
  end
end

And set the attribute through PATCH /api/oidc-users/:sub.

We want to have the as many of the attributes needed to return the
GET /api/user response stored locally as possible, so the homepage
is nice and fast.


Trello card

This is not just `!email_verified`:

- `email` - this is the email address the user registered with, or a
  new email address they have confirmed.

- `email_verified` - the user needs to verify the email address they
  registered with, this starts `false`, becomes `true`, and then never
  returns to `false`

- `has_unconfirmed_email` - this is `true` if `email_verified` is
  `false` OR the user has a pending email change to confirm

So,

    if has_unconfirmed_email
      if email_verified
        show "finish changing your email address" banner
      else
        show "confirm your account" banner
      end
    end
We want to have the as many of the attributes needed to return the
`GET /api/user` response stored locally as possible, so the homepage
is nice and fast.
@@ -16,6 +16,7 @@
{
email: "[email protected]",
email_verified: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this is a one-way-switch...
is there any utility in making this someting more like:
email_verified_on: "2021-01-01", where nil means never verified?
Wonder if that is a better form of history than true or `false?

Whereas has_unconfirmed_email is a representation of present state?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atch, but then we'd have to update email_verified_at and perhaps that's just another thing that could go wrong. Probably nevermind!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option might be to have a three state thing:

email_state = :confirmed
email_state = :pending_reconfirmation
email_state = :pending_confirmation

Base automatically changed from msw/email-subscriptions to main June 17, 2021 13:20
@barrucadu barrucadu merged commit 2bb7aac into main Jun 17, 2021
@barrucadu barrucadu deleted the msw/has-unconfirmed-email branch June 17, 2021 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants