Skip to content

Commit 134e870

Browse files
dvanwinkledrew-gross
authored andcommitted
Added the ability to accept encrypted passwords (#487)
* Added the ability to accept encrypted passwords * Updated readme * Updated README to include a link to a bcrypt tool
1 parent 92d7fa8 commit 134e870

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Parse-Dashboard/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ module.exports = function(config, allowInsecureHTTP) {
8686
}
8787

8888
let appsUserHasAccess = null;
89+
let bcrypt = require('bcryptjs');
8990

9091
const successfulAuth =
9192
//they provided auth
9293
auth &&
9394
//there are configured users
9495
users &&
9596
//the provided auth matches one of the users
96-
users.find(user => {
97+
users.find(user => {
9798
let isAuthorized = user.user == auth.name &&
98-
user.pass == auth.pass
99+
(user.pass == auth.pass ||
100+
bcrypt.compareSync(auth.pass, user.pass));
99101
if (isAuthorized) {
100102
// User restricted apps
101103
appsUserHasAccess = user.apps

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ You can configure your dashboard for Basic Authentication by adding usernames an
234234
}
235235
```
236236

237+
You can store the password in either `plain text` or `bcrypt` formats. You can encrypt the password using any online bcrypt tool e.g. [https://www.bcrypt-generator.com](https://www.bcrypt-generator.com).
238+
237239
### Separating App Access Based on User Identity
238240
If you have configured your dashboard to manage multiple applications, you can restrict the management of apps based on user identity.
239241

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"commander": "^2.9.0",
3737
"express": "^4.13.4",
3838
"json-file-plus": "^3.2.0",
39-
"package-json": "^2.3.1"
39+
"package-json": "^2.3.1",
40+
"bcryptjs": "^2.3.0"
4041
},
4142
"devDependencies": {
4243
"babel-core": "~5.8.12",

0 commit comments

Comments
 (0)