hmn/src/templates/src
bvisness 0210a0784b Add Discord login (#106)
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: #106
2023-05-06 19:38:50 +00:00
..
fishbowls Add entrepereuship fishbowl (#99) 2022-10-03 20:30:03 +00:00
include Add Discord login (#106) 2023-05-06 19:38:50 +00:00
layouts Add jam recap (not yet shown off properly) 2023-04-21 23:11:32 -05:00
404.html Added our 404 page 2021-05-04 16:23:02 +03:00
about.html Nobody saw this 2022-12-14 19:23:32 -06:00
admin_approval_queue.html Added snippets to admin approval queue 2022-08-07 02:03:34 +03:00
admin_atom.xml User approval admin page and RSS 2021-09-24 03:13:40 +03:00
atom.xml Probably fixed RSS issue in showcase feed. 2022-10-20 13:57:03 +03:00
auth_do_password_reset.html Update auth flows 2022-08-13 14:15:00 -05:00
auth_email_validation.html Update auth flows 2022-08-13 14:15:00 -05:00
auth_login.html Add Discord login (#106) 2023-05-06 19:38:50 +00:00
auth_password_reset.html Update auth flows 2022-08-13 14:15:00 -05:00
auth_password_reset_sent.html Update auth flows 2022-08-13 14:15:00 -05:00
auth_register.html Update auth flows 2022-08-13 14:15:00 -05:00
auth_register_success.html Update auth flows 2022-08-13 14:15:00 -05:00
blog_index.html Only show blog content preview in blog index when there are few posts 2022-06-14 20:15:16 +03:00
blog_post.html Disable forum/blog actions for projects that don't have them enabled 2021-11-11 12:11:57 -08:00
blog_post_delete.html Add all the rest of the blog post operations 2021-07-30 18:08:42 -05:00
communication_guidelines.html Fixed communication guidelines attribution. 2022-02-16 05:38:41 +02:00
conferences.html HMS banner goes to the 2022 guide, and the link on the conferences page 2022-12-03 18:44:52 +02:00
contact.html Rework about page, finally 2022-12-14 17:49:08 -06:00
discordtest.html Add Discord unlinking 2021-08-16 00:07:17 -05:00
editor.html Consolidated shared editor-related params 2022-09-15 00:44:27 +03:00
education_article.html Better edu home page 2022-10-27 00:20:59 -05:00
education_article_delete.html Initial version of education content (#90) 2022-09-10 16:29:57 +00:00
education_glossary.html Initial version of education content (#90) 2022-09-10 16:29:57 +00:00
education_index.html Add highlight to currently-selected education course 2022-10-31 17:39:19 -05:00
email_password_reset.html Update auth flows 2022-08-13 14:15:00 -05:00
email_registration.html Update auth flows 2022-08-13 14:15:00 -05:00
episode.html Episode guide and trailing slashes in urls 2021-08-28 13:40:13 +03:00
episode_list.html Episode guide and trailing slashes in urls 2021-08-28 13:40:13 +03:00
error.html Fix mailto on crash page 2022-06-01 20:49:19 -05:00
feed.html Rework the home page 2021-10-27 21:55:40 -05:00
fishbowl.html Don't do clever hue-rotating trick with waterline image 2022-06-12 08:39:44 -05:00
fishbowl_index.html Add all jams index 2023-04-22 11:26:07 -05:00
forum.html Disable forum/blog actions for projects that don't have them enabled 2021-11-11 12:11:57 -08:00
forum_post_delete.html Clean up forums.go 2021-07-23 15:35:18 -05:00
forum_thread.html Disable forum/blog actions for projects that don't have them enabled 2021-11-11 12:11:57 -08:00
foundation.html Rework about page, finally 2022-12-14 17:49:08 -06:00
jam_2021_wrj_index.html Vis jam landing page 2023-03-07 11:48:13 -06:00
jam_2022_wrj_feed.html Vis jam landing page 2023-03-07 11:48:13 -06:00
jam_2022_wrj_index.html Vis jam landing page 2023-03-07 11:48:13 -06:00
jam_2023_vj_feed.html Link back to the main jam page from the feed 2023-04-14 15:46:06 -05:00
jam_2023_vj_index.html Put recap section on the main page 2023-04-22 09:18:34 -05:00
jam_2023_vj_recap.html Put recap section on the main page 2023-04-22 09:18:34 -05:00
jams_index.html Fix CSS issue on jams page 2023-04-22 11:31:14 -05:00
landing.html News posts are BACK 2023-04-13 17:41:10 -05:00
manifesto.html New manifesto?? 2023-04-12 19:10:29 -05:00
markdown_worker.js Initial version of education content (#90) 2022-09-10 16:29:57 +00:00
monthly_update_policy.html Replaced all handmadedev.org emails with handmade.network addresses 2021-08-17 08:22:41 +03:00
podcast.xml Added correct time format for podcast. 2021-09-06 22:48:39 +03:00
podcast_edit.html Registration flow and email 2021-08-08 23:05:52 +03:00
podcast_episode.html Podcasts 2021-07-23 06:09:46 +03:00
podcast_episode_edit.html Registration flow and email 2021-08-08 23:05:52 +03:00
podcast_index.html Podcasts 2021-07-23 06:09:46 +03:00
project.css Update auth flows 2022-08-13 14:15:00 -05:00
project_edit.html Consolidated shared editor-related params 2022-09-15 00:44:27 +03:00
project_homepage.html Style project descriptions better 2023-04-16 16:05:04 -05:00
project_index.html Add automatic scrolling behavior to jam carousel 2022-08-02 15:14:29 -05:00
project_submission_guidelines.html More static pages 2021-05-04 18:14:30 +03:00
reject.html Clean up TODOs 2021-08-28 12:07:45 -05:00
role_advocacy.html Rework about page, finally 2022-12-14 17:49:08 -06:00
role_design.html Rework about page, finally 2022-12-14 17:49:08 -06:00
role_education.html Rework about page, finally 2022-12-14 17:49:08 -06:00
roles.html Rework about page, finally 2022-12-14 17:49:08 -06:00
showcase.html Rework the home page 2021-10-27 21:55:40 -05:00
snippet.html Snippet creation and editing 2022-08-06 00:41:37 +03:00
twitch_debug.html Added logs for twitch 2022-08-29 01:18:55 +03:00
user_profile.html allow #recent anchor 2023-01-12 02:42:57 +01:00
user_settings.html Add Discord login (#106) 2023-05-06 19:38:50 +00:00
whenisit.html Added whenisit and default opengraph items 2021-08-17 22:48:44 +03:00
whenisit_setup.html Added whenisit and default opengraph items 2021-08-17 22:48:44 +03:00