-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Hide unsubscribe button on channel list if this is set in parental controls. * Fix github linting errors * Removed trailing whitespace. * Reverted yarn.lock change * Remove package-lock.json * Added support for password protecting settings. * Push password handling code inside password-settings component. * Added incorrect password message * Replace update method with watch. * Use updateSettingsPassword to commit value to database. * Move password settings to the bottom (review comment) * Moved unlock into separate component (review feedback) * Styling password dialog * Removed incorrect (and unused) prop value - review comment. * Removed unused component imports Co-authored-by: Simon Epstein <simon.epstein@67bricks.com>
- Loading branch information
1 parent
79cd65c
commit dbb5473
Showing
11 changed files
with
273 additions
and
29 deletions.
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
10 changes: 10 additions & 0 deletions
10
src/renderer/components/password-dialog/password-dialog.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,10 @@ | ||
.card { | ||
position: relative; | ||
width: 85%; | ||
height: 25%; | ||
margin: auto; | ||
box-sizing: border-box; | ||
} | ||
.passwordInput { | ||
width: 100%; | ||
} |
58 changes: 58 additions & 0 deletions
58
src/renderer/components/password-dialog/password-dialog.js
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,58 @@ | ||
import Vue from 'vue' | ||
import { mapActions } from 'vuex' | ||
import FtCard from '../ft-card/ft-card.vue' | ||
import FtInput from '../ft-input/ft-input.vue' | ||
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' | ||
import FtPrompt from '../ft-prompt/ft-prompt.vue' | ||
|
||
export default Vue.extend({ | ||
name: 'PasswordDialog', | ||
components: { | ||
'ft-input': FtInput, | ||
'ft-card': FtCard, | ||
'ft-flex-box': FtFlexBox, | ||
'ft-prompt': FtPrompt, | ||
}, | ||
emits: ['settingsUnlocked'], | ||
data: function() { | ||
return { | ||
password: '', | ||
showIncorrectPassword: false | ||
} | ||
}, | ||
computed: { | ||
getStoredPassword: function() { | ||
return this.$store.getters.getSettingsPassword | ||
}, | ||
incorrectPassword: function() { | ||
return this.password !== '' && !this.unlocked | ||
}, | ||
unlocked: function() { | ||
return this.getStoredPassword === '' || this.password === this.getStoredPassword | ||
} | ||
}, | ||
watch: { | ||
unlocked(val, oldVal) { | ||
if (val !== oldVal) { | ||
this.propagateUnlockStatus() | ||
} | ||
}, | ||
}, | ||
mounted: function () { | ||
this.propagateUnlockStatus() | ||
this.$refs.password.focus() | ||
}, | ||
methods: { | ||
handleLock: function () { | ||
this.password = '' | ||
this.showIncorrectPassword = false | ||
}, | ||
propagateUnlockStatus: function() { | ||
this.$emit('settingsUnlocked', this.unlocked) | ||
}, | ||
...mapActions([ | ||
'updateSettingsPassword' | ||
]), | ||
|
||
} | ||
}) |
31 changes: 31 additions & 0 deletions
31
src/renderer/components/password-dialog/password-dialog.vue
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,31 @@ | ||
<template> | ||
<div> | ||
<ft-card | ||
class="card" | ||
> | ||
<h3>{{ $t("Settings.Password Dialog.Enter Password To Unlock") }}</h3> | ||
|
||
<ft-flex-box> | ||
<ft-input | ||
ref="password" | ||
:placeholder="$t('Settings.Password Dialog.Password')" | ||
:show-action-button="false" | ||
input-type="password" | ||
class="passwordInput" | ||
:value="password" | ||
@input="e => password = e" | ||
/> | ||
</ft-flex-box> | ||
<ft-prompt | ||
v-if="showIncorrectPassword" | ||
:label="$t('Settings.Password Dialog.Password Incorrect')" | ||
:option-names="[$t('Ok')]" | ||
:option-values="['ok']" | ||
@click="handleLock" | ||
/> | ||
</ft-card> | ||
</div> | ||
</template> | ||
|
||
<script src="./password-dialog.js" /> | ||
<style scoped src="./password-dialog.css" /> |
58 changes: 58 additions & 0 deletions
58
src/renderer/components/password-settings/password-settings.js
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,58 @@ | ||
import Vue from 'vue' | ||
import { mapActions } from 'vuex' | ||
import FtSettingsSection from '../ft-settings-section/ft-settings-section.vue' | ||
import FtInput from '../ft-input/ft-input.vue' | ||
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' | ||
import FtButton from '../ft-button/ft-button.vue' | ||
|
||
export default Vue.extend({ | ||
name: 'PasswordSettings', | ||
components: { | ||
'ft-settings-section': FtSettingsSection, | ||
'ft-input': FtInput, | ||
'ft-flex-box': FtFlexBox, | ||
'ft-button': FtButton, | ||
}, | ||
emits: ['settingsUnlocked'], | ||
data: function() { | ||
return { | ||
password: '', | ||
} | ||
}, | ||
computed: { | ||
getStoredPassword: function() { | ||
return this.$store.getters.getSettingsPassword | ||
}, | ||
hasStoredPassword: function() { | ||
return this.getStoredPassword !== '' | ||
}, | ||
unlocked: function() { | ||
return this.getStoredPassword === '' || this.password === this.getStoredPassword | ||
} | ||
}, | ||
watch: { | ||
unlocked(val, oldVal) { | ||
if (val !== oldVal) { | ||
this.propagateUnlockStatus() | ||
} | ||
}, | ||
}, | ||
methods: { | ||
handleSetPassword: function () { | ||
this.updateSettingsPassword(this.password) | ||
this.password = '' | ||
}, | ||
handleRemovePassword: function () { | ||
this.updateSettingsPassword('') | ||
this.password = '' | ||
}, | ||
propagateUnlockStatus: function() { | ||
this.$emit('settingsUnlocked', this.unlocked) | ||
}, | ||
|
||
...mapActions([ | ||
'updateSettingsPassword' | ||
]), | ||
|
||
} | ||
}) |
36 changes: 36 additions & 0 deletions
36
src/renderer/components/password-settings/password-settings.vue
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,36 @@ | ||
<template> | ||
<ft-settings-section | ||
:title="$t('Settings.Password Settings.Password Settings')" | ||
> | ||
<div> | ||
<ft-flex-box | ||
v-if="hasStoredPassword" | ||
class="settingsFlexStart460px" | ||
> | ||
<ft-button | ||
:label="$t('Settings.Password Settings.Remove Password')" | ||
@click="handleRemovePassword" | ||
/> | ||
</ft-flex-box> | ||
<ft-flex-box | ||
v-else | ||
class="settingsFlexStart460px" | ||
> | ||
<ft-input | ||
:placeholder="$t('Settings.Password Settings.Set Password To Prevent Access')" | ||
:show-action-button="false" | ||
:show-label="true" | ||
input-type="password" | ||
:value="password" | ||
@input="e => password = e" | ||
/> | ||
<ft-button | ||
:label="$t('Settings.Password Settings.Set Password')" | ||
@click="handleSetPassword" | ||
/> | ||
</ft-flex-box> | ||
</div> | ||
</ft-settings-section> | ||
</template> | ||
|
||
<script src="./password-settings.js" /> |
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