Skip to content

Commit

Permalink
Update email protection in settings (duckduckgo#827)
Browse files Browse the repository at this point in the history
* Update Email Protection section in settings

Signed-off-by: Emanuele Feliziani <feliziani.emanuele@gmail.com>

* Prevent error in settings page on Chrome

Signed-off-by: Emanuele Feliziani <feliziani.emanuele@gmail.com>

* Update email protection text in settings

Signed-off-by: Emanuele Feliziani <feliziani.emanuele@gmail.com>
  • Loading branch information
GioSensation authored Sep 1, 2021
1 parent d62fb51 commit 10248dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion shared/js/ui/models/user-data.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ UserData.prototype = window.$.extend({},

logout () {
this.fetch({ logout: true })
.then(() => this.set('loggingOut', true))
.then(() => this.set('userName', null))
},

setUserDataFromSettings: function () {
Expand Down
14 changes: 7 additions & 7 deletions shared/js/ui/templates/user-data.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ const bel = require('bel')
const { formatAddress } = require('../../background/email-utils.es6')

module.exports = function () {
// We don't render anything if the user is not set
if (!this.model.userName) return bel`<div></div>`

return bel`<section class="options-content__user-data divider-bottom">
<h2 class="menu-title">Email Autofill</h2>
<h2 class="menu-title">Email Protection</h2>
${renderUserDataContent(this.model)}
</section>`
}

function renderUserDataContent (model) {
return model.loggingOut
return (!model.userName)
? bel`<div>
<p class="menu-paragraph">Disabled successfully.</p>
<p class="menu-paragraph">Autofill disabled</p>
<p class="options-info">
<a href="https://duckduckgo.com/email/enable-autofill">Enable</a>
</p>
</div>`
: bel`<div>
<p class="menu-paragraph">
Enabled for <strong class="js-userdata-container">${formatAddress(model.userName)}</strong>
Autofill enabled for <strong class="js-userdata-container">${formatAddress(model.userName)}</strong>
</p>
<p class="options-info js-userdata-logout">
<a href="#">Disable</a>
Expand Down

0 comments on commit 10248dc

Please sign in to comment.