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

[env/github] map SAML SSO data from Okta into user's profile data #1667

Merged
merged 26 commits into from
Jun 28, 2021

Conversation

mike-lvov
Copy link
Contributor

@mike-lvov mike-lvov commented Jun 25, 2021

closes https://github.com/sparkletown/internal-sparkle-issues/issues/767

Get data from Okta and apply it to the app.
Adds new user fields.

Will need to base it off env/github, once it's updated with the latest staging This has been done now

@mike-lvov mike-lvov added the 💡 new-feature New idea/feature request label Jun 25, 2021
@mike-lvov mike-lvov requested a review from a team June 25, 2021 21:59
@mike-lvov mike-lvov self-assigned this Jun 25, 2021
@mike-lvov mike-lvov temporarily deployed to feature-preview June 25, 2021 21:59 Inactive
src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
@codeclimate
Copy link

codeclimate bot commented Jun 25, 2021

Code Climate has analyzed commit 15dfaa4 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 2

View more on Code Climate.

@github-actions
Copy link

github-actions bot commented Jun 25, 2021

Visit the preview URL for this PR (updated for commit 15dfaa4):

https://co-reality-staging--preview-pr-1667-zq61mbfg.web.app

(expires Mon, 12 Jul 2021 00:11:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

src/types/User.ts Outdated Show resolved Hide resolved
@mike-lvov mike-lvov changed the title Feature/apply saml mappings apply saml mappings Jun 27, 2021
@mike-lvov mike-lvov temporarily deployed to feature-preview June 28, 2021 00:07 Inactive
@github-actions github-actions bot added the 💎 styles For (S)CSS style related issues/changes/improvements/etc. label Jun 28, 2021
@mike-lvov mike-lvov changed the base branch from staging to env/github June 28, 2021 00:11
@mike-lvov mike-lvov changed the base branch from env/github to staging June 28, 2021 00:11
@mike-lvov mike-lvov marked this pull request as ready for review June 28, 2021 00:12
@mike-lvov mike-lvov changed the base branch from staging to env/github June 28, 2021 00:23
@0xdevalias 0xdevalias changed the title apply saml mappings [env/github] map SAML SSO data from Okta into user's profile data Jun 28, 2021
@0xdevalias 0xdevalias added P1 - Critical Priority 1 - Critical 🔒 security For issues/PRs related to security features (including addressing security vulnerabilities) labels Jun 28, 2021
Copy link
Contributor

@0xdevalias 0xdevalias left a comment

Choose a reason for hiding this comment

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

A bunch of comments/changes/etc. I'll probably try and fix these up today to save time since I assume you're offline at the moment.

src/types/User.ts Outdated Show resolved Hide resolved
src/utils/localStorage.ts Outdated Show resolved Hide resolved
src/utils/profile.ts Outdated Show resolved Hide resolved
src/utils/profile.ts Outdated Show resolved Hide resolved
src/utils/profile.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@0xdevalias 0xdevalias left a comment

Choose a reason for hiding this comment

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

Few more changes needed here.

Comment on lines 127 to 147
const getRenderedAvatarImageComponent = useCallback(
(avatarSrc: string, key: string | number) => (
<div
key={`${avatar}-${index}`}
key={`${avatarSrc}-${key}`}
className="profile-picture-preview-container"
onClick={() => uploadDefaultAvatar(avatar)}
onClick={() => uploadDefaultAvatar(avatarSrc)}
>
<img
src={avatar}
src={avatarSrc}
className="profile-icon profile-picture-preview"
alt={`default avatar ${index}`}
alt={`default avatar ${key}`}
/>
</div>
));
}, [defaultAvatars, uploadDefaultAvatar]);
),
[uploadDefaultAvatar]
);

const avatarImages = useMemo(() => {
const renderedAvatarImages = defaultAvatars.map(
getRenderedAvatarImageComponent
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't see why we would bother keeping getRenderedAvatarImageComponent instead of just inlining it within avatarImages.

defaultAvatars is a string[]

githubImageSrc is a string | undefined

So just do something like:

[githubAvatarImage, ...defaultAvatars].filter(isDefined).map((avatarSrc) =>
  <div
    key={avatarSrc}
    // ..snip..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 36f9ee2

Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you use the index as part of the key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0xdevalias legacy logic

Comment on lines 76 to 81
return (
<React.Fragment key={question.text}>
<p className="light question">{question.text}</p>
<p className="light no-margin">{question.text}</p>
<h6>{questionAnswer}</h6>
</React.Fragment>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

[OOS] But the usage of h6 here is SUPER janky. Header tags shouldn't be used for styling like this. This breaks all sorts of accessibility rules.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually.. bootstrap has classes that mirror the header styling. Can you change this to a div or something and use the h6 class at the very least? Should be a quick fix for it i'm guessing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why are they junky though? Note that this is for env/github only

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure which bootstrap you are referring to, but it looks like here the h1 tags are also used.
https://mdbootstrap.com/docs/standard/navigation/headers/

Copy link
Contributor

Choose a reason for hiding this comment

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

'Bootstrap' refers to https://getbootstrap.com/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 41dc9b2

Out of curiousity, hoes does it effect the all sorts of accessibility rules?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks :)

I explained this way back in the past. But basically headings have a very specific and defined semantic meaning in HTML structure, that is used by screen readers/etc.

This was from a quick google, there may be other/better resources:

src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
src/pages/Account/Profile.tsx Outdated Show resolved Hide resolved
src/utils/profile.ts Outdated Show resolved Hide resolved
mike-lvov and others added 3 commits June 28, 2021 13:41
Co-authored-by: Glenn 'devalias' Grant <glenn@devalias.net>
Co-authored-by: Glenn 'devalias' Grant <glenn@devalias.net>
@mike-lvov
Copy link
Contributor Author

Done the editing
image

Copy link
Contributor

@0xdevalias 0xdevalias left a comment

Choose a reason for hiding this comment

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

I believe this comment still needs addressing: #1667 (comment)

But aside from that, I think this looks good to go.

Note: I've only code reviewed, not clickthrough/etc. But if you're happy with how it looks/functions, LGTM! :shipit:

@mike-lvov mike-lvov enabled auto-merge June 28, 2021 12:01
@mike-lvov mike-lvov disabled auto-merge June 28, 2021 12:01
@mike-lvov mike-lvov merged commit 534bbd1 into env/github Jun 28, 2021
@mike-lvov mike-lvov deleted the feature/apply-SAML-mappings branch June 28, 2021 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔒 security For issues/PRs related to security features (including addressing security vulnerabilities) 💡 new-feature New idea/feature request P1 - Critical Priority 1 - Critical 💎 styles For (S)CSS style related issues/changes/improvements/etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants