-
Notifications
You must be signed in to change notification settings - Fork 93
✨(frontend) store and retrieve user token in sessionStorage #2724
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
Open
kernicPanel
wants to merge
6
commits into
master
Choose a base branch
from
keycloak
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b21887e
✨(frontend) store and retrieve user token in sessionStorage
kernicPanel b61b0ae
✨(frontend) adapt personal information verification for Keycloak
kernicPanel cf64116
✨(backend) add referrer info to Keycloak account URL
kernicPanel 71f33ec
✨(frontend) enhance Keycloak initialization and token handling
kernicPanel 38e3382
🔥(backend) remove unused Keycloak token configuration
kernicPanel dc41a00
🐛(frontend) enhances Keycloak token expiration handling
kernicPanel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,9 @@ import WithdrawRightCheckbox from 'components/SaleTunnel/WithdrawRightCheckbox'; | |||||
| import { PaymentSchedule, ProductType } from 'types/Joanie'; | ||||||
| import { usePaymentPlan } from 'hooks/usePaymentPlan'; | ||||||
| import { HttpError } from 'utils/errors/HttpError'; | ||||||
| import { APIBackend, KeycloakAccountApi } from 'types/api'; | ||||||
| import context from 'utils/context'; | ||||||
| import { AuthenticationApi } from 'api/authentication'; | ||||||
|
|
||||||
| const messages = defineMessages({ | ||||||
| title: { | ||||||
|
|
@@ -49,6 +52,31 @@ const messages = defineMessages({ | |||||
| defaultMessage: | ||||||
| 'This email will be used to send you confirmation mails, it is the one you created your account with.', | ||||||
| }, | ||||||
| keycloakUsernameLabel: { | ||||||
| id: 'components.SaleTunnel.Information.keycloak.account.label', | ||||||
| description: 'Label for the name', | ||||||
| defaultMessage: 'Account name', | ||||||
| }, | ||||||
| keycloakUsernameInfo: { | ||||||
| id: 'components.SaleTunnel.Information.keycloak.account.info', | ||||||
| description: 'Info for the name', | ||||||
| defaultMessage: 'This name will be used in legal documents.', | ||||||
| }, | ||||||
| keycloakEmailInfo: { | ||||||
| id: 'components.SaleTunnel.Information.keycloak.email.info', | ||||||
| description: 'Info for the email', | ||||||
| defaultMessage: 'This email will be used to send you confirmation mails.', | ||||||
| }, | ||||||
| keycloakAccountLinkInfo: { | ||||||
| id: 'components.SaleTunnel.Information.keycloak.updateLinkInfo', | ||||||
| description: 'Text before the keycloak account update link', | ||||||
| defaultMessage: 'If any of the information above is incorrect,', | ||||||
| }, | ||||||
| keycloakAccountLinkLabel: { | ||||||
| id: 'components.SaleTunnel.Information.keycloak.updateLinkLabel', | ||||||
| description: 'Label of the keycloak link to update account', | ||||||
| defaultMessage: 'please update your account', | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }, | ||||||
| voucherTitle: { | ||||||
| id: 'components.SaleTunnel.Information.voucher.title', | ||||||
| description: 'Title for the voucher', | ||||||
|
|
@@ -130,6 +158,8 @@ export const SaleTunnelInformationSingular = () => { | |||||
| setNeedsPayment(!fromBatchOrder); | ||||||
| }, [fromBatchOrder, setNeedsPayment]); | ||||||
|
|
||||||
| const isKeycloakBackend = context?.authentication.backend === APIBackend.KEYCLOAK; | ||||||
|
|
||||||
| return ( | ||||||
| <> | ||||||
| <div> | ||||||
|
|
@@ -148,11 +178,17 @@ export const SaleTunnelInformationSingular = () => { | |||||
| <div className="description mb-s"> | ||||||
| <FormattedMessage {...messages.description} /> | ||||||
| </div> | ||||||
| <OpenEdxFullNameForm /> | ||||||
| <AddressSelector /> | ||||||
| <div className="mt-s"> | ||||||
| <Email /> | ||||||
| </div> | ||||||
| {isKeycloakBackend ? ( | ||||||
| <KeycloakAccountEdit /> | ||||||
| ) : ( | ||||||
| <> | ||||||
| <OpenEdxFullNameForm /> | ||||||
| <div className="mt-s"> | ||||||
| <Email /> | ||||||
| </div> | ||||||
| </> | ||||||
| )} | ||||||
| </div> | ||||||
| )} | ||||||
| <div> | ||||||
|
|
@@ -163,6 +199,51 @@ export const SaleTunnelInformationSingular = () => { | |||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| const KeycloakAccountEdit = () => { | ||||||
| const accountApi = AuthenticationApi!.account as KeycloakAccountApi; | ||||||
kernicPanel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| const { user } = useSession(); | ||||||
|
|
||||||
| return ( | ||||||
| <> | ||||||
| <div className="mt-s"> | ||||||
| <div className="sale-tunnel__username"> | ||||||
| <div className="sale-tunnel__username__top"> | ||||||
| <h4> | ||||||
| <FormattedMessage {...messages.keycloakUsernameLabel} /> | ||||||
| </h4> | ||||||
| <div className="fw-bold">{user?.username}</div> | ||||||
| </div> | ||||||
| <div className="sale-tunnel__username__description"> | ||||||
| <FormattedMessage {...messages.keycloakUsernameInfo} /> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div className="mt-s"> | ||||||
| <div className="sale-tunnel__email"> | ||||||
| <div className="sale-tunnel__email__top"> | ||||||
| <h4> | ||||||
| <FormattedMessage {...messages.emailLabel} /> | ||||||
| </h4> | ||||||
| <div className="fw-bold">{user?.email}</div> | ||||||
| </div> | ||||||
| <div className="sale-tunnel__email__description"> | ||||||
| <FormattedMessage {...messages.keycloakEmailInfo} /> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div className="mt-s"> | ||||||
| <div className="sale-tunnel__account-link"> | ||||||
| <FormattedMessage {...messages.keycloakAccountLinkInfo} />{' '} | ||||||
| <a href={accountApi.updateUrl()}> | ||||||
| <FormattedMessage {...messages.keycloakAccountLinkLabel} /> | ||||||
| </a> | ||||||
| . | ||||||
| </div> | ||||||
| </div> | ||||||
| </> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| const Email = () => { | ||||||
| const { user } = useSession(); | ||||||
| const { data: openEdxProfileData } = useOpenEdxProfile({ | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.