This leverages our existing Discord OAuth implementation. Any users with a linked Discord account will be able to log in immediately. When logging in, we request the `email` scope in addition to `identity`, so existing users will be prompted one time to accept the new permissions. On subsequent logins, Discord will skip the prompt.
When linking your Discord account to an existing HMN account, we continue to only request the `identity` scope, so we do not receive the user's Discord email.
Both login and linking go through the same Discord OAuth callback. All flows through the callback try to achieve the same end goal: a logged-in HMN user with a linked Discord account.
Linking works the same as it ever has. Login, however, is different because we do not have a session ID to use as the OAuth state. To account for this, I have added a `pending_login` table that stores a secure unique ID and the eventual destination URL. These pending logins expire after 10 minutes. When we receive the OAuth callback, we look up the pending login by the OAuth `state` and immediately delete it. The destination URL will be used to redirect the user to the right place.
If we have a `discord_user` entry for the OAuth'd Discord user, we immediately log the user into the associated HMN account. This is the typical login case. If we do not have a `discord_user`, but there is exactly one HMN user with the same email address as the Discord user, we will link the two accounts and log into the HMN account.
(It is possible for multiple HMN accounts to have the same email, because we don't have a uniqueness constraint there. We fail the login in this case rather than link to the wrong account.)
Finally, if no associated HMN user exists, a new one will be created. It will use the Discord user's username, email, and avatar. This user will have no password, but they can set or reset a password through the usual flows.
Co-authored-by: Ben Visness <bvisness@gmail.com>
Reviewed-on: hmn/hmn#106
Start foundation / about page work
Add some job descriptions
Add Advocacy role
Make things look barely tolerable
Cloin'd
Better About intro
no fundo
Link from manifesto
swanky changes
Code notes:
* ❗ MathJax treats text between two dollar signs as math. Escaped those cases in html (`\$`) - is there a way to not run mathjax on fishbowls instead?
* Limited embed image sizes to match Discord
* Fixed replies to a quote wrapping on a new line
Content notes:
* Moved intros to the top, untangled the discussions (hopefully without significant loss), pulled in audience comments
* Most book links are to Amazon as the promo websites are shitty or non-functioning
* Demetri had interesting points in -audience afterwards but they tie to Allen and may be hard to pull in without a lot of context
* Catchy title and description are TBD as usual
Co-authored-by: Ilia Demianenko <ilia.demianenko@gmail.com>
Reviewed-on: hmn/hmn#99
Co-authored-by: ilidemi <belk94@gmail.com>
Co-committed-by: ilidemi <belk94@gmail.com>
Following the discussion on [#74](hmn/hmn#74), here are changes to the submit buttons so that they match theme/project color.
Border colors are set to match the button background.
I've also included a "bugfix" where the `editor-toolbar-button-background` parameter in the dark theme.css and variables.scss were missing the # sign.
I wasn't sure whether to remove the `form button` values from theme.css and variables.scss and left them, as I'm not sure they're used anywhere now
Reviewed-on: hmn/hmn#80
Co-authored-by: giggs <darkgiggsxx@gmail.com>
Co-committed-by: giggs <darkgiggsxx@gmail.com>
It didn't work when creating a new project or editing personal projects,
due to routing issues. I also took this opportunity to make the script
support multiple form submit buttons, since in some cases we will have a
submit button on each tab, and I figured they all should respect the
fact that you have an upload in progress.