-
Notifications
You must be signed in to change notification settings - Fork 887
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
Implements UIs for the "create account" and "sign in" flows in brave://settings
#26741
Conversation
The security team is monitoring all repositories for certain keywords. This PR includes the word(s) "password" and so security team members have been added as reviewers to take a look. |
A Storybook has been deployed to preview UI for the latest push |
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.
Hey this looks great - I had a dig into _html_template_start_
- man, this is why we can't have nice things 😆
It's such an ugly way of solving it, it makes me sad 😆 Thanks upstream.
My only real comment is that we should use a mojo interface instead of a handler
browser/resources/settings/getting_started_page/getting_started.html
Outdated
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/getting_started.ts
Outdated
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_browser_proxy.ts
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_common.ts
Outdated
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_create_dialog.ts
Show resolved
Hide resolved
this.isCheckboxChecked = detail.checked | ||
} | ||
|
||
// TODO(sszaloki): we should consider exporting `noChange` |
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.
out of interest, why would we need noChange
here?
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.
Basically, when there's a matching password in the password confirmation field, we show the checkmark and the text Passwords match
. Now, if the user presses Cmd
+ Backspace
on the text in the password confirmation field, we should just hide the dropdown and should not recalculate which icon or text to show — since the password confirmation field became empty, and there's nothing in there we should try to match against the field above. That's an edge-case here, but if we don't do anything, there's a visual artifact: the icon changes to the red triangle, while the text changes to Passwords don't match
, and then the dropdown disappears — which looks rookie. 🙂
The proper way to handle that would be via signaling with noChange
that we don't need a change in the DOM if this.passwordConfirmation.length === 0
. Alternatively, there is this hack we have in brave_account_create_dialog.ts
, but it's far from ideal, as the TS file is required to know about style-related stuff (i.e. name of icons).
browser/resources/settings/getting_started_page/brave_account_dialog.html.ts
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_forgot_password_dialog.html.ts
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_row.html.ts
Show resolved
Hide resolved
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.
This is looking awesome! Thank you @szilardszaloki !
Sign in or create a Brave account | ||
</message> | ||
<message name="IDS_SETTINGS_BRAVE_ACCOUNT_ROW_DESCRIPTION" translateable="false" desc="Description of the Brave Account row in the Get Started section"> | ||
A Brave account will allow you to easily sync your settings, passwords, bookmarks, etc. across all your devices and access our full range of premium products. |
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.
We'll need to update that since we are shipping accounts without support for Sync (for the time being).
<message name="IDS_SETTINGS_BRAVE_ACCOUNT_ALREADY_HAVE_ACCOUNT_SIGN_IN_BUTTON_LABEL" translateable="false" desc="Label for the button that takes the user to the 'Sign In' dialog"> | ||
Already have an account? Sign in | ||
</message> | ||
<message name="IDS_SETTINGS_BRAVE_ACCOUNT_SELF_CUSTODY_DESCRIPTION" translateable="false" desc="Description of the self-custody option which we provide for advanced users"> |
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.
The self-custody option should not be there until we are ready to integrate with Sync.
browser/resources/settings/getting_started_page/brave_account_common.ts
Outdated
Show resolved
Hide resolved
browser/ui/webui/settings/brave_settings_localized_strings_provider.cc
Outdated
Show resolved
Hide resolved
browser/ui/webui/settings/brave_settings_localized_strings_provider.cc
Outdated
Show resolved
Hide resolved
@@ -48,6 +48,13 @@ namespace settings { | |||
|
|||
namespace { | |||
|
|||
constexpr char16_t kBraveAccountSelfCustodyLearnMoreURL[] = |
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.
We don't need self-custody this for now.
I don't think I saw it in this PR: does this include the |
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.
patch and browser/ui/BUILD.gn changes ok
9e189ec
to
24e1608
Compare
@fmarier Adding it to the current dropdown implementation introduces a visual artifact similar to the one being discussed here. Filed here for now — we'll likely want to export |
06236ec
to
bbbbbed
Compare
browser/resources/settings/getting_started_page/brave_account_create_dialog.ts
Outdated
Show resolved
Hide resolved
browser/resources/settings/getting_started_page/brave_account_common.ts
Outdated
Show resolved
Hide resolved
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.
string reviewers ++
NOTE: I defer the content of the strings to @fmarier who has already left a comment 😄
But LGTM!
Contents of the strings will need to change (as per my earlier comments) but since this is not enabled by default (and not translated) we can do that later as we get closer to enabling. So it's fine for now. |
bbbbbed
to
9f6e7b5
Compare
[puLL-Merge] - brave/brave-core@26741 DescriptionThis PR introduces a new Brave Account feature in the browser settings. It adds several new dialogs for account creation, sign-in, and password reset, as well as a new row in the "Get started" section of settings for managing the Brave account. ChangesChanges
sequenceDiagram
participant User
participant BraveSettingsUI
participant BraveAccountHandler
participant BraveAccountRow
participant BraveAccountDialog
User->>BraveSettingsUI: Open Settings
BraveSettingsUI->>BraveAccountRow: Display Account Row
User->>BraveAccountRow: Click "Get started"
BraveAccountRow->>BraveAccountDialog: Show Entry Dialog
User->>BraveAccountDialog: Choose Create Account
BraveAccountDialog->>BraveAccountDialog: Show Create Account Dialog
User->>BraveAccountDialog: Enter Account Details
BraveAccountDialog->>BraveAccountHandler: Get Password Strength
BraveAccountHandler-->>BraveAccountDialog: Return Password Strength
User->>BraveAccountDialog: Submit Account Creation
Note over BraveAccountDialog: Account Creation Logic (Not Implemented)
BraveAccountDialog-->>BraveAccountRow: Update Account Status
Possible Issues
Security Hotspots
|
Released in v1.75.93 |
Resolves brave/brave-browser#42508.
create_account_and_sign_in.mp4
Note: the tooltip and the corresponding regular expression-based password score implementation in the "create account" dialog have been removed in favor of getting the password strength from
zxcvbn
.Known issues:
Lit
element's HTML template is to have it defined in an.html.ts
file that's directly checked in to the repository, that is, no.html
files are going through thehtml_to_wrapper
target in the WebUI build pipeline. As such, the HTML template definition is lacking the<!--_html_template_start_-->
and<!--_html_template_end_-->
tags, without which the C++ templatizer does not do any text replacements — hence those tags are currently added manually.TODOs:
noChange
fromthird_party/lit/v3_0/lit.ts
(which has been recently removed in Chromium due to deleting their only reference to it) and use it instead of the workaround that addresses a visual artifact inbrave_account_create_dialog.html.ts
.Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
—