Skip to content

Commit 50f4577

Browse files
committed
Don't show password hash in the settings page
1 parent 4170e8d commit 50f4577

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

app/locales/en/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
"Download": "Download",
107107
"Everything": "Everything",
108108
"encryption": {
109+
"provide password": "Please, provide your password",
110+
"change password": "Type your password here to change it",
109111
"wait": "Please wait until the encryption is completed",
110112
"error": "Encryption error",
111113
"errorConfirm": "Error while decrypting data.\r\r If you changed encryption settings in another browser, **update your settings** in this browser too. Or try to import settings.\r\r And if you did not change anything, **try to login** again.",

app/scripts/apps/settings/show/templates/encryption.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="form-group">
1313
<label class="col-sm-2 control-label" for="encryptPass">{{ i18n('Encryption Password') }}</label>
1414
<div class="col-sm-10">
15-
<input type="password" id="encryptPass" name="encryptPass" value="{{models.encryptPass.toString()}}" class="form-control" >
15+
<input type="password" id="encryptPass" name="encryptPass" value="" placeholder="{{passwordText()}}" class="form-control" />
1616
</div>
1717
</div>
1818
<div class="form-group">

app/scripts/apps/settings/show/views/encryption.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ define([
6868
}
6969

7070
return sjcl.codec.hex.fromBits(str);
71-
}
71+
},
72+
73+
passwordText: function() {
74+
if (this.models.encryptPass.length !== 0) {
75+
return $.t('encryption.change password');
76+
}
77+
return $.t('encryption.provide password');
78+
},
7279
};
7380
},
7481

@@ -93,7 +100,7 @@ define([
93100
* changed.
94101
*/
95102
randomizeOnPassword: function() {
96-
if (this.ui.password.val().trim() === this.collection.get('encryptPass').get('value').toString()) {
103+
if (!this.ui.password.val().trim().length) {
97104
return;
98105
}
99106

app/scripts/collections/modules/configs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ define([
1111
'q',
1212
'marionette',
1313
'backbone.radio',
14+
'sjcl',
1415
'collections/modules/module',
1516
'collections/configs'
16-
], function(_, Q, Marionette, Radio, ModuleObject, Configs) {
17+
], function(_, Q, Marionette, Radio, sjcl, ModuleObject, Configs) {
1718
'use strict';
1819

1920
/**
@@ -398,7 +399,7 @@ define([
398399
}
399400

400401
// Additional check to make sure it's not the same password
401-
var salt = Radio.request('encrypt', 'sha256', object.value);
402+
var salt = sjcl.hash.sha256.hash(object.value);
402403
return (salt.toString() !== pass);
403404
},
404405

0 commit comments

Comments
 (0)