mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-26 07:39:04 +02:00
#646 Implement confirm master password
This commit is contained in:
parent
91f08b0853
commit
3e55478f4b
|
@ -394,7 +394,9 @@
|
|||
"setFileSyncInProgress": "sync in progress",
|
||||
"setFileSyncError": "Sync error",
|
||||
"setFilePass": "Master password",
|
||||
"setFileConfirmPass": "Confirm Master password",
|
||||
"setFilePassChanged": "your password was changed; leave the field blank to use the old password",
|
||||
"setFilePassNotMatch": "confirmed password does not match the master password; your password will not be updated",
|
||||
"setFileKeyFile": "Key file",
|
||||
"setFileSelKeyFile": "Select a key file",
|
||||
"setFileNames": "Names",
|
||||
|
|
|
@ -31,6 +31,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
'focus #settings__file-master-pass': 'focusMasterPass',
|
||||
'input #settings__file-master-pass': 'changeMasterPass',
|
||||
'blur #settings__file-master-pass': 'blurMasterPass',
|
||||
'focus #settings__file-confirm-master-pass': 'focusConfirmMasterPass',
|
||||
'input #settings__file-confirm-master-pass': 'changeConfirmMasterPass',
|
||||
'blur #settings__file-confirm-master-pass': 'blurConfirmMasterPass',
|
||||
'input #settings__file-name': 'changeName',
|
||||
'input #settings__file-def-user': 'changeDefUser',
|
||||
'change #settings__file-backup-enabled': 'changeBackupEnabled',
|
||||
|
@ -80,6 +83,7 @@ const SettingsFileView = Backbone.View.extend({
|
|||
syncError: this.model.get('syncError'),
|
||||
syncDate: Format.dtStr(this.model.get('syncDate')),
|
||||
password: PasswordGenerator.present(this.model.get('passwordLength')),
|
||||
confirmPassword: PasswordGenerator.present(this.model.get('passwordLength')),
|
||||
defaultUser: this.model.get('defaultUser'),
|
||||
recycleBinEnabled: this.model.get('recycleBinEnabled'),
|
||||
backupEnabled: backup && backup.enabled,
|
||||
|
@ -372,7 +376,6 @@ const SettingsFileView = Backbone.View.extend({
|
|||
this.model.resetPassword();
|
||||
this.$el.find('.settings__file-master-pass-warning').hide();
|
||||
} else {
|
||||
this.model.setPassword(kdbxweb.ProtectedValue.fromString(e.target.value));
|
||||
if (!this.model.get('created')) {
|
||||
this.$el.find('.settings__file-master-pass-warning').show();
|
||||
}
|
||||
|
@ -388,6 +391,32 @@ const SettingsFileView = Backbone.View.extend({
|
|||
e.target.setAttribute('type', 'password');
|
||||
},
|
||||
|
||||
focusConfirmMasterPass: function(e) {
|
||||
e.target.value = '';
|
||||
e.target.setAttribute('type', 'text');
|
||||
},
|
||||
|
||||
changeConfirmMasterPass: function(e) {
|
||||
const masterPassword = this.$el.find('#settings__file-master-pass').val();
|
||||
const confirmPassword = e.target.value;
|
||||
if (confirmPassword === masterPassword) {
|
||||
this.model.setPassword(kdbxweb.ProtectedValue.fromString(e.target.value));
|
||||
this.$el.find('.settings__file-confirm-master-pass-warning').hide();
|
||||
} else {
|
||||
this.model.resetPassword();
|
||||
this.$el.find('.settings__file-confirm-master-pass-warning').show();
|
||||
}
|
||||
},
|
||||
|
||||
blurConfirmMasterPass: function(e) {
|
||||
if (!e.target.value) {
|
||||
this.model.resetPassword();
|
||||
e.target.value = PasswordGenerator.present(this.model.get('passwordLength'));
|
||||
this.$el.find('.settings__file-confirm-master-pass-warning').hide();
|
||||
}
|
||||
e.target.setAttribute('type', 'password');
|
||||
},
|
||||
|
||||
changeName: function(e) {
|
||||
const value = $.trim(e.target.value);
|
||||
if (!value) {
|
||||
|
|
|
@ -91,11 +91,11 @@
|
|||
margin-bottom: $base-padding-v;
|
||||
}
|
||||
|
||||
#settings__file-master-pass {
|
||||
#settings__file-master-pass, #settings__file-confirm-master-pass {
|
||||
font-family: $monospace-font-family;
|
||||
}
|
||||
|
||||
&__file-master-pass-warning {
|
||||
&__file-master-pass-warning, &__file-confirm-master-pass-warning {
|
||||
font-weight: normal;
|
||||
float: right;
|
||||
display: none;
|
||||
|
|
|
@ -56,6 +56,12 @@
|
|||
<input type="password" style="display:none" name="password">
|
||||
</div>
|
||||
<input type="password" class="settings__input input-base" id="settings__file-master-pass" value="{{password}}" autocomplete="new-password" />
|
||||
<label for="settings__file-master-pass" class="settings__file-master-pass-label input-base">{{res 'setFileConfirmPass'}}:
|
||||
<span class="settings__file-confirm-master-pass-warning">
|
||||
<i class="fa fa-warning"></i> {{res 'setFilePassNotMatch'}}
|
||||
</span>
|
||||
</label>
|
||||
<input type="password" class="settings__input input-base" id="settings__file-confirm-master-pass" value="{{confirmPassword}}" autocomplete="confirm-password" />
|
||||
<label for="settings__file-key-file">{{res 'setFileKeyFile'}}:</label>
|
||||
<select class="settings__select settings__select-no-margin input-base" id="settings__file-key-file"></select>
|
||||
<a id="settings__file-file-select-link">{{res 'setFileSelKeyFile'}}</a>
|
||||
|
|
Loading…
Reference in New Issue
Block a user