This repository was archived by the owner on Apr 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
style(signup): improve styling of password advice #7042
Open
lmorchard
wants to merge
1
commit into
mozilla:master
Choose a base branch
from
lmorchard:6448-password-advice-style
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
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
5 changes: 5 additions & 0 deletions
5
app/scripts/templates/partial/password-repeat-balloon.mustache
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <aside id="password-repeat-balloon" class="input-help input-help-balloon password-repeat-balloon"> | ||
| <ul> | ||
| <li class="lock last big-only">{{#unsafeTranslate}}Remember this password — it encrypts your data! If forgotten you will lose access to Sync data.{{/unsafeTranslate}}</li> | ||
| </ul> | ||
| </aside> |
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| import PasswordWithRepeatBalloonView from '../password_repeat/password_with_repeat_balloon'; | ||
|
|
||
| /** | ||
| * Create the mixin to set up the password repeat UI. | ||
| * | ||
| * @param {Object} config | ||
| * @param {String} config.balloonEl selector where the password repeat balloon should attach | ||
| * @param {String} config.passwordEl selector for the password element to watch | ||
| * @returns {Object} the mixin | ||
| */ | ||
| export default function (config = {}) { | ||
| const { balloonEl, passwordEl } = config; | ||
|
|
||
| return { | ||
| afterRender () { | ||
| return Promise.resolve().then(() => { | ||
| if (! this.$(passwordEl).length) { | ||
| return; | ||
| } | ||
| const passwordView = this._createPasswordWithRepeatBalloonView(); | ||
| this.trackChildView(passwordView); | ||
| }); | ||
| }, | ||
|
|
||
| _createPasswordWithRepeatBalloonView () { | ||
| return new PasswordWithRepeatBalloonView({ | ||
| balloonEl: this.$(balloonEl), | ||
| el: this.$(passwordEl), | ||
| lang: this.lang, | ||
| translator: this.translator | ||
| }); | ||
| } | ||
| }; | ||
| } |
77 changes: 77 additions & 0 deletions
77
app/scripts/views/password_repeat/password_repeat_balloon.js
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 |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| /** | ||
| * Display a password strength balloon. Component automatically | ||
| * updates whenever changes are made to the underlying model. | ||
| * | ||
| * @export | ||
| * @class PasswordRepeatBalloonView | ||
| * @extends {BaseView} | ||
| */ | ||
|
|
||
| import BaseView from '../base'; | ||
| import Cocktail from 'cocktail'; | ||
| import OneVisibleOfTypeMixin from '../mixins/one-visible-of-type-mixin'; | ||
| import Template from '../../templates/partial/password-repeat-balloon.mustache'; | ||
|
|
||
| // Allow the balloon to stay visible for a bit so that | ||
| // the user can see all the criteria were met. | ||
| const DELAY_BEFORE_HIDE_MS = 750; | ||
|
|
||
| const DELAY_BEFORE_HIDE_BALLOON_EL_MS = 500; | ||
|
|
||
| const PASSWORD_REPEAT_BALLOON_SELECTOR = '.password-repeat-balloon'; | ||
|
|
||
| class PasswordRepeatBalloonView extends BaseView { | ||
| template = Template; | ||
|
|
||
| initialize (config = {}) { | ||
| this.delayBeforeHideMS = config.delayBeforeHideMS || DELAY_BEFORE_HIDE_MS; | ||
| } | ||
|
|
||
| afterRender () { | ||
| this.show(); | ||
| } | ||
|
|
||
| update () { | ||
| this.clearTimeouts(); | ||
| return this.render() | ||
| .then(() => this.hideAfterDelay()); | ||
| } | ||
|
|
||
| clearTimeouts () { | ||
| this.clearTimeout(this._hideTimeout); | ||
| this.clearTimeout(this._hideBalloonElTimeout); | ||
| } | ||
|
|
||
| show () { | ||
| this.$(PASSWORD_REPEAT_BALLOON_SELECTOR).show().css('opacity', '1'); | ||
| } | ||
|
|
||
| hide () { | ||
| const $balloonEl = this.$(PASSWORD_REPEAT_BALLOON_SELECTOR); | ||
| $balloonEl.css('opacity', '0'); | ||
| this._hideBalloonElTimeout = this.setTimeout(() => { | ||
| $balloonEl.hide(); | ||
| }, DELAY_BEFORE_HIDE_BALLOON_EL_MS); | ||
| } | ||
|
|
||
| hideAfterDelay () { | ||
| this._hideTimeout = this.setTimeout(() => { | ||
| this.hide(); | ||
| }, this.delayBeforeHideMS); | ||
| } | ||
| } | ||
|
|
||
| Cocktail.mixin( | ||
| PasswordRepeatBalloonView, | ||
| OneVisibleOfTypeMixin({ | ||
| hideMethod: 'hide', | ||
| showMethod: 'show', | ||
| viewType: 'tooltip' | ||
| }) | ||
| ); | ||
|
|
||
| export default PasswordRepeatBalloonView; |
51 changes: 51 additions & 0 deletions
51
app/scripts/views/password_repeat/password_with_repeat_balloon.js
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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| /** | ||
| * Creates and manages a PasswordRepeatBalloon. | ||
| * Updates to the bound password element cause updates to the model | ||
| * which are propagated out to the PasswordRepeatBalloon to | ||
| * update the UI. | ||
| * | ||
| * @export | ||
| * @class PasswordWithRepeatBalloonView | ||
| * @extends {FormView} | ||
| */ | ||
|
|
||
| import FormView from '../form'; | ||
| import PasswordRepeatBalloonView from './password_repeat_balloon'; | ||
|
|
||
| const PasswordWithRepeatBalloonView = FormView.extend({ | ||
| events: { | ||
| blur: 'hideBalloon', | ||
| focus: 'showBalloon', | ||
| }, | ||
|
|
||
| initialize (options = {}) { | ||
| this.passwordHelperBalloon = options.passwordHelperBalloon; | ||
| this.balloonEl = options.balloonEl; | ||
| }, | ||
|
|
||
| showBalloon () { | ||
| if (! this.passwordHelperBalloon) { | ||
| this.passwordHelperBalloon = new PasswordRepeatBalloonView({ | ||
| el: this.balloonEl, | ||
| lang: this.lang, | ||
| model: this.model, | ||
| translator: this.translator | ||
| }); | ||
| this.trackChildView(this.passwordHelperBalloon); | ||
| } | ||
| return this.passwordHelperBalloon.render() | ||
| .then(() => this.passwordHelperBalloon.show()); | ||
| }, | ||
|
|
||
| hideBalloon () { | ||
| if (this.passwordHelperBalloon) { | ||
| return this.passwordHelperBalloon.hide(); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| export default PasswordWithRepeatBalloonView; |
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
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.
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.
evlooks unused.