-
Notifications
You must be signed in to change notification settings - Fork 31
[feat] User-initiated email change flow #2830
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
029f6e1
[feat] Account settings section with self-serve change-email modal (f…
Will-Howard 7e1b742
Add user-facing email change UI
Will-Howard 0bcd782
[docs] Add screenshots for PR #2830
Will-Howard dae228c
[docs] Remove screenshot files (SHA-pinned URLs keep working)
Will-Howard 3644694
[style] Shorten the email-taken error message
Will-Howard 06f72bd
[docs] Updated conflict-state screenshots
Will-Howard 91b2029
[docs] Remove screenshot files (SHA-pinned URLs keep working)
Will-Howard 7cefdf6
[feat] Rate limit self-serve email change requests to 3 attempts per …
Will-Howard 7212048
[feat] Send a courtesy notice to the old email when a self-serve emai…
Will-Howard d60a15c
[refactor] Share the new-email schema between ChangeEmailModal and th…
Will-Howard 3154704
[refactor] Focus the new-email input with autoFocus instead of a setT…
Will-Howard 29c8a9e
[refactor] Submit ChangeEmailModal via a semantic form instead of a k…
Will-Howard 60c38af
[fix] Don't count email change attempts that fail on our own infra to…
Will-Howard cd4cc5b
[style] Drop the nothing-changes line from the courtesy notice
Will-Howard 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,10 @@ import { TRPCClientError } from '@trpc/client'; | |
| import { useEffect, useRef, useState } from 'react'; | ||
| import { changePasswordWithConfirmSchema } from '../../lib/schemas/user/changePassword.schema'; | ||
| import { trpc } from '../../utils/trpc'; | ||
| import ChangeEmailModal from './ChangeEmailModal'; | ||
|
|
||
| const PasswordSection = () => { | ||
| const AccountSettingsSection = () => { | ||
| const [showChangeEmailModal, setShowChangeEmailModal] = useState(false); | ||
| const [showChangePasswordModal, setShowChangePasswordModal] = useState(false); | ||
| const [passwordUpdateSuccess, setPasswordUpdateSuccess] = useState(false); | ||
|
|
||
|
|
@@ -26,16 +28,25 @@ const PasswordSection = () => { | |
|
|
||
| return ( | ||
| <> | ||
| {/* Password Section */} | ||
| {/* Account Settings Section */} | ||
| <div className="mb-6"> | ||
| <P className="font-semibold mb-2">Password</P> | ||
| <CTALinkOrButton | ||
| variant="secondary" | ||
| onClick={() => setShowChangePasswordModal(true)} | ||
| aria-label="Change password" | ||
| > | ||
| Change Password | ||
|
Collaborator
Author
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. "Change Password" -> "Change password". From looking at recent changes I think sentence case is the direction we're going in, though it's not completely consistent |
||
| </CTALinkOrButton> | ||
| <P className="font-semibold mb-2">Account settings</P> | ||
| <div className="flex flex-col items-start gap-3"> | ||
| <CTALinkOrButton | ||
| variant="secondary" | ||
| onClick={() => setShowChangeEmailModal(true)} | ||
| aria-label="Change email" | ||
| > | ||
| Change email | ||
| </CTALinkOrButton> | ||
| <CTALinkOrButton | ||
| variant="secondary" | ||
| onClick={() => setShowChangePasswordModal(true)} | ||
| aria-label="Change password" | ||
| > | ||
| Change password | ||
| </CTALinkOrButton> | ||
| </div> | ||
| {passwordUpdateSuccess && ( | ||
| <p | ||
| className="text-size-sm text-green-600 mt-2" | ||
|
|
@@ -47,6 +58,12 @@ const PasswordSection = () => { | |
| )} | ||
| </div> | ||
|
|
||
| {/* Change Email Modal */} | ||
| <ChangeEmailModal | ||
| isOpen={showChangeEmailModal} | ||
| setIsOpen={setShowChangeEmailModal} | ||
| /> | ||
|
|
||
| {/* Change Password Modal */} | ||
| <ChangePasswordModal | ||
| isOpen={showChangePasswordModal} | ||
|
|
@@ -171,8 +188,9 @@ const ChangePasswordModal = ({ | |
| }; | ||
|
|
||
| return ( | ||
| <Modal isOpen={isOpen} setIsOpen={setIsOpen} title="Change Password"> | ||
| <div className="space-y-4"> | ||
| <Modal isOpen={isOpen} setIsOpen={setIsOpen} title="Change password" bottomDrawerOnMobile> | ||
| <div className="w-full max-w-modal space-y-4"> | ||
| <div className="h-0 w-[600px] max-w-full" /> | ||
| <div> | ||
| <Input | ||
| ref={currentPasswordRef} | ||
|
|
@@ -186,7 +204,7 @@ const ChangePasswordModal = ({ | |
| }} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder="Enter current password" | ||
| label="Current Password*" | ||
| label="Current password*" | ||
| aria-label="Current password" | ||
| aria-describedby={ | ||
| errors.current ? 'current-password-error' : undefined | ||
|
|
@@ -218,7 +236,7 @@ const ChangePasswordModal = ({ | |
| }} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder="Enter new password" | ||
| label="New Password*" | ||
| label="New password*" | ||
| aria-label="New password" | ||
| aria-describedby={ | ||
| errors.new ? 'new-password-error' : 'new-password-hint' | ||
|
|
@@ -228,7 +246,7 @@ const ChangePasswordModal = ({ | |
| /> | ||
| {!errors.new && ( | ||
| <p | ||
| className="text-gray-600 text-size-sm mt-1" | ||
| className="text-charcoal-mid text-size-sm mt-1" | ||
|
Will-Howard marked this conversation as resolved.
|
||
| id="new-password-hint" | ||
| > | ||
| Password must be at least 8 characters | ||
|
|
@@ -258,7 +276,7 @@ const ChangePasswordModal = ({ | |
| }} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder="Confirm new password" | ||
| label="Confirm New Password*" | ||
| label="Confirm new password*" | ||
| aria-label="Confirm new password" | ||
| aria-describedby={ | ||
| errors.confirm ? 'confirm-password-error' : undefined | ||
|
|
@@ -299,7 +317,7 @@ const ChangePasswordModal = ({ | |
| <span>Updating...</span> | ||
| </span> | ||
| ) : ( | ||
| 'Update Password' | ||
| 'Update password' | ||
| )} | ||
| </CTALinkOrButton> | ||
| </div> | ||
|
|
@@ -308,4 +326,4 @@ const ChangePasswordModal = ({ | |
| ); | ||
| }; | ||
|
|
||
| export default PasswordSection; | ||
| export default AccountSettingsSection; | ||
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.