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

Allow for logging in with Contentful OAuth #525

Merged
merged 26 commits into from
Nov 17, 2023

Conversation

Benaiah
Copy link
Contributor

@Benaiah Benaiah commented Nov 15, 2023

Proposed changes

  • Allows logging into the site with an OAuth2 flow that uses your existing Contentful login

Acceptance criteria validation

  • Manually tested
  • Existing tests pass

Other details

Post-merge checklist:

  • Change environment variables in Vercel to point at the production URL of the LDAF site
  • Change OAuth2 app settings in Contentful to point at the production URL of the LDAF site

Copy link

vercel bot commented Nov 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ldaf ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 17, 2023 11:27pm

@Benaiah Benaiah force-pushed the benaiah/allow-logging-in-with-contentful-account branch from 81c2627 to de46169 Compare November 15, 2023 02:24
@Benaiah Benaiah marked this pull request as ready for review November 15, 2023 03:06
Copy link
Contributor

@hinzed1127 hinzed1127 left a comment

Choose a reason for hiding this comment

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

A couple small things and then good to merge.

I know w've got login/logout tests, but a good follow-up would be to add some tests specific to the OAuth login flow. That's probably more suited to puppeteer, I'd think?

src/routes/callback/oauth2/+page.svelte Outdated Show resolved Hide resolved
@Benaiah Benaiah force-pushed the benaiah/allow-logging-in-with-contentful-account branch from e40eca3 to a558a0e Compare November 17, 2023 22:40
…anges-when-logged-in' into benaiah/allow-logging-in-with-contentful-account
Base automatically changed from benaiah/allow-viewing-preview-changes-when-logged-in to main November 17, 2023 23:18
Copy link

Coverage after merging benaiah/allow-logging-in-with-contentful-account into main will be

94.88%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/hooks/server
   handleCurrentUserAndContentfulClient.ts88.94%78.13%100%90.80%132–141, 150–151, 52–53, 57, 57, 73–75, 94–96
src/lib/actions
   logout.ts48.78%0%0%51.28%18–37
src/lib/components/Accordion
   Accordion.svelte100%100%100%100%
   AccordionItem.svelte94.12%55.56%100%100%23, 33, 46, 48
   context.ts100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/Alert
   Alert.svelte94.74%57.14%100%100%34, 41, 41
src/lib/components/AnnouncementBanner
   AnnouncementBanner.svelte100%100%100%100%
src/lib/components/Breadcrumbs
   Breadcrumbs.svelte100%100%100%100%
src/lib/components/Button
   Button.svelte96.77%50%100%100%41, 50
   buttonOptions.ts100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/Card
   Card.svelte97.50%0%100%100%7
   CardGroup.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/ConditionalWrapper
   ConditionalWrapper.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/ContactCard
   ContactCard.svelte98.91%93.75%100%100%54
   Section.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/ContentfulRichText
   ContentfulRichText.svelte97.87%0%100%100%25
   context.ts98%80%100%100%8
   headings.ts93.18%50%100%95.12%37–39
   predicates.ts90.76%100%70%94.12%68, 76, 79, 82, 85
src/lib/components/ContentfulRichText/nodes
   AssetHyperlink.svelte100%100%100%100%
   Blockquote.svelte100%100%100%100%
   EmbeddedAssetBlock.svelte87.50%0%100%100%12, 16, 20, 29, 36–38
   EmbeddedEntry.svelte100%100%100%100%
   EmbeddedEntryBlock.svelte100%100%100%100%
   EntryHyperlink.svelte100%100%100%100%
   Heading1.svelte100%100%100%100%
   Heading2.svelte100%100%100%100%
   Heading3.svelte100%100%100%100%
   Heading4.svelte100%100%100%100%
   Heading5.svelte100%100%100%100%
   Heading6.svelte100%100%100%100%
   Hr.svelte100%100%100%100%
   Hyperlink.svelte100%100%100%100%
   ListItem.svelte100%100%100%100%
   Node.svelte92.86%0%100%100%6
   OrderedList.svelte100%100%100%100%
   Paragraph.svelte100%100%100%100%
   Table.svelte100%100%100%100%
   TableCell.svelte100%100%100%100%
   TableHeaderCell.svelte100%100%100%100%
   TableRow.svelte100%100%100%100%
   Text.svelte100%100%100%100%
   UnorderedList.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/CopyToClipboard
   CopyToClipboard.svelte97.50%60%100%100%71, 71
   index.ts100%100%100%100%
src/lib/components/Footer
   Footer.svelte95.24%55%100%100%105, 105, 108, 108, 38, 63, 69, 69, 75
src/lib/components/Header
   Header.svelte94.44%50%100%100%47, 47–48, 48, 51
src/lib/components/Header/Logo
   Logo.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/Header/Nav
   Nav.svelte97.06%83.33%100%100%19
   NavItem.svelte100%100%100%100%
   NavLink.svelte100%100%100%100%
   NavMenu.svelte96.40%70.59%100%100%100, 77, 79, 88, 98
   index.ts100%100%100%100%
src/lib/components/Header/Title
   Title.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/Header/User
   User.svelte93.33%0%100%100%9
   index.ts100%100%100%100%
src/lib/components/Header/__mocks__
   HeaderBackgroundImage.svelte100%100%100%100%
src/lib/components/Icon
   Icon.svelte87.50%20%100%100%19, 19, 24, 24
   index.ts100%100%100%100%
src/lib/components/Image
   BlurhashRenderer.svelte100%100%100%100%
   Image.svelte90.86%67.74%66.67%96.35%115, 149, 165, 167–168, 201, 206, 211–215, 241–245, 245, 267–268, 33, 35, 38, 50, 61, 61–62, 72–74
   index.ts100%100%100%100%
   renderBlurhash.ts100%100%100%100%
src/lib/components/IntersectionObserver
   IntersectionObserver.svelte94.74%75%100%100%36–37, 39
   RootIntersectionObserver.svelte85.19%0%100%92%14–17
   index.ts100%100%100%100%
   key.ts100%100%100%100%
   observe.ts99.03%93.33%100%100%73
src/lib/components/Link
   Link.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/LogoutLink
   LogoutLink.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/Search
   Search.svelte91.30%33.33%100%96.77%37–39, 44, 44, 48
   index.ts100%100%100%100%
   options.ts100%100%100%100%
src/lib/components/SideNav
   SideNav.svelte100%100%100%100%
   SideNavItem.svelte100%100%100%100%
src/lib/components/Tag
   Tag.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/VideoCard
   VideoCard.svelte91.30%0%0%94.23%103–112, 53, 78
   getTrimmedFirstParagraph.ts100%100%100%100%
   index.ts100%100%100%100%
src/lib/components/YoutubeSubscribeLink
   YoutubeSubscribeLink.svelte100%100%100%100%
   index.ts100%100%100%100%
src/lib/constants
   date.ts100%100%100%100%
   images.ts100%100%100%100%
   support.ts43.75%0%100%50%12–14, 4–9
   tokenDuration.ts100%100%100%100%
src/lib/context
   currentUser.ts88.89%100%50%93.33%14
   pageMetadataMap.ts100%100%100%100%
src/lib/imageServices
   contentful.ts97.06%86.67%100%100%21, 48
src/lib/services/blurhashes
   index.ts50%100%0%52.94%22–38, 49–51, 6–9
src/lib/services/server/contentful
   graphqlClient.ts90.91%75%100%92.05%71–78, 80
   index.ts100%100%100%100%
src/lib/services/server/contentfulManagement
   getCurrentUser.ts98.08%66.67%100%100%25
   index.ts100%100%100%100%
src/lib/services/server/kv/__mocks__
   index.ts93.55%100%100%92.86%21, 25
src/lib/services/server/youtube
   getYoutubeVideoData.ts74.63%16.67%50%81.36%33–34, 38, 40, 44, 49–59
src/lib/util
   classNames.ts100%100%100%100%
   dates.ts78.57%100%60%79.41%14–17, 32–34
   getErrorMessage.ts63.16%20%100%76.92%10–11, 2–3, 7–9
   getErrorMessageFromResponse.ts20%25%20%19.72%12–19, 2, 20, 23–29, 3, 30–45, 50–59, 6, 60–69, 7, 70–71, 8–9
   getYoutubeVideoIDFromURL.ts66.67%33.33%100%80%3, 3–4
   resolveWithStatus.server.ts100%100%100%100%
   slugify.ts100%100%100%100%
   warn.ts100%100%100%100%
src/routes/login
   +page.server.ts89.71%70%100%92.98%32–35, 49, 52–53
src/routes/logout
   +page.server.ts81.82%75%100%82.35%11–14
src/stories
   AccordionView.svelte100%100%100%100%
   CardView.svelte99.10%50%100%100%75

Copy link

@Benaiah Benaiah merged commit 309626a into main Nov 17, 2023
7 checks passed
@Benaiah Benaiah deleted the benaiah/allow-logging-in-with-contentful-account branch November 17, 2023 23:37
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