This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Add Self-service Password Change #2863
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f5e74ec
Add fake password preview and 'change account' link to account manage…
reivilibre 85f58a0
Add password change form to React frontend
reivilibre 65d1a38
en locale update for password change form
reivilibre fd6aadf
fr locale update (partial) for password change form
reivilibre 60363ea
Don't show password change link if password changes are disabled
reivilibre 32356f2
Don't show password box if passwords are disabled
reivilibre 241c803
Apply suggestions from code review
reivilibre 415d2dc
Remove unnecessary wrapper for AccountManagementPasswordPreview
reivilibre 53b2276
Tweak error messages
reivilibre a626ae2
Remove needless style from AccountManagementPasswordPreview
reivilibre 05ab6bd
Split out password change success to its own route
reivilibre befdeea
_ -> /
reivilibre de2859e
Change style of success page
reivilibre e5a21a6
Move alerts to top of form
reivilibre 2c8ed61
Don't show inline errors twice
reivilibre 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 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 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 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 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
32 changes: 32 additions & 0 deletions
32
...c/components/AccountManagementPasswordPreview/AccountManagementPasswordPreview.module.css
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Copyright 2024 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.link { | ||
display: inline-block; | ||
text-decoration: underline; | ||
color: var(--cpd-color-text-primary); | ||
font-weight: var(--cpd-font-weight-medium); | ||
border-radius: var(--cpd-radius-pill-effect); | ||
padding-inline: 0.25rem; | ||
} | ||
|
||
.link:hover { | ||
background: var(--cpd-color-gray-300); | ||
} | ||
|
||
.link:active { | ||
background: var(--cpd-color-text-primary); | ||
color: var(--cpd-color-text-on-solid-primary); | ||
} |
62 changes: 62 additions & 0 deletions
62
...tend/src/components/AccountManagementPasswordPreview/AccountManagementPasswordPreview.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2024 The Matrix.org Foundation C.I.C. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { Link } from "@tanstack/react-router"; | ||
import { Form } from "@vector-im/compound-web"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
import { FragmentType, graphql, useFragment } from "../../gql"; | ||
|
||
import styles from "./AccountManagementPasswordPreview.module.css"; | ||
|
||
const CONFIG_FRAGMENT = graphql(/* GraphQL */ ` | ||
fragment PasswordChange_siteConfig on SiteConfig { | ||
id | ||
passwordChangeAllowed | ||
} | ||
`); | ||
|
||
export default function AccountManagementPasswordPreview({ | ||
siteConfig, | ||
}: { | ||
siteConfig: FragmentType<typeof CONFIG_FRAGMENT>; | ||
}): React.ReactElement { | ||
const { t } = useTranslation(); | ||
const { passwordChangeAllowed } = useFragment(CONFIG_FRAGMENT, siteConfig); | ||
|
||
return ( | ||
<Form.Root> | ||
<Form.Field name="password_preview"> | ||
<Form.Label>{t("frontend.account.password.label")}</Form.Label> | ||
|
||
<Form.TextControl | ||
type="password" | ||
readOnly | ||
value="this looks like a password" | ||
/> | ||
|
||
<Form.HelpMessage> | ||
{passwordChangeAllowed && ( | ||
<Link to="/password/change" className={styles.link}> | ||
{t("frontend.account.password.change")} | ||
</Link> | ||
)} | ||
|
||
{!passwordChangeAllowed && | ||
t("frontend.account.password.change_disabled")} | ||
</Form.HelpMessage> | ||
</Form.Field> | ||
</Form.Root> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
frontend/src/components/AccountManagementPasswordPreview/index.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2024 The Matrix.org Foundation C.I.C. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
export { default } from "./AccountManagementPasswordPreview"; |
This file contains 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an existing Link component which should have the same style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stole this from
UserEmail
FWIWThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
Link
component does not have the underline or the white text colour, it just looks like plain grey textThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fundamentally we're missing a good implementation of the Text Link component: https://www.figma.com/design/rTaQE2nIUSLav4Tg3nozq7/Compound-Web-Components?node-id=645-3494&t=OH2MjoxKqsJTB1vF-4
I'll leave the duplication for now, and will see to implement that in Compound