parse-dashboard 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +384 -0
- package/LICENSE +30 -0
- package/Parse-Dashboard/Authentication.js +145 -0
- package/Parse-Dashboard/CLI/mfa.js +225 -0
- package/Parse-Dashboard/CLI/utils.js +7 -0
- package/Parse-Dashboard/CLIHelper.js +6 -0
- package/Parse-Dashboard/app.js +229 -0
- package/Parse-Dashboard/index.js +199 -0
- package/Parse-Dashboard/parse-dashboard-config.json +14 -0
- package/Parse-Dashboard/public/bundles/dashboard.bundle.js +120 -0
- package/Parse-Dashboard/public/bundles/img/151bd0d0acab0c914cf28e7ceba3fed8.jpg +0 -0
- package/Parse-Dashboard/public/bundles/img/4400f45c001b956571860243d332df58.jpg +0 -0
- package/Parse-Dashboard/public/bundles/img/69665d8b6f6f575b2a22907909a456a1.png +0 -0
- package/Parse-Dashboard/public/bundles/img/8c98d067435fab4b09c017471f51648e.png +0 -0
- package/Parse-Dashboard/public/bundles/img/dc9bd65a9fc3e6b981413630496bd936.jpg +0 -0
- package/Parse-Dashboard/public/bundles/img/f8c84bccdc8cdeed8ded6ff40f55f090.jpg +0 -0
- package/Parse-Dashboard/public/bundles/login.bundle.js +30 -0
- package/Parse-Dashboard/public/bundles/sprites.svg +396 -0
- package/Parse-Dashboard/public/favicon.ico +0 -0
- package/README.md +619 -0
- package/bin/parse-dashboard +2 -0
- package/package.json +153 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Parse Dashboard Changelog
|
|
2
|
+
|
|
3
|
+
# master
|
|
4
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/3.0.0...master)
|
|
5
|
+
|
|
6
|
+
## New Features
|
|
7
|
+
## Improvements
|
|
8
|
+
## Fixes
|
|
9
|
+
|
|
10
|
+
# 3.0.0
|
|
11
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.2.0...3.0.0)
|
|
12
|
+
|
|
13
|
+
## BREAKING CHANGE
|
|
14
|
+
- Parse Dashboard requires Node >=12.0.0 <16.0.0
|
|
15
|
+
- Reverts PR [#1706](https://github.com/parse-community/parse-dashboard/pull/1706) which introduced new database index requirements for pagination and was a breaking change that can lead to database performance issues if database indices were not adapted; reverting #1706 removes the `objectId` from the compound query; make sure that the database indices satisfy your dashboard sorting and filter usage before upgrading to this release to prevent database performance issues due to missing indices (Christopher Brookes) [#1800](https://github.com/parse-community/parse-dashboard/pull/1800)
|
|
16
|
+
|
|
17
|
+
## New Features
|
|
18
|
+
- Add multi-factor authentication to dashboard login. To use one-time password, run `parse-dashboard --createMFA` or `parse-dashboard --createUser`. (Daniel Blyth) [#1624](https://github.com/parse-community/parse-dashboard/pull/1624)
|
|
19
|
+
|
|
20
|
+
## Improvements
|
|
21
|
+
- Sidebar: Class counts are now updated when all counts are returned instead of after each call (Christopher Brookes) [#1802](https://github.com/parse-community/parse-dashboard/pull/1802)
|
|
22
|
+
- Update sass to 5.0.0 and make docker image use node:lts-alpine (Corey Baker) [#1792](https://github.com/parse-community/parse-dashboard/pull/1792)
|
|
23
|
+
- Docker image use now node 12 version (Christopher Brookes) [#1788](https://github.com/parse-community/parse-dashboard/pull/1788)
|
|
24
|
+
- CI now pushes docker images to Docker Hub (Corey Baker) [#1781](https://github.com/parse-community/parse-dashboard/pull/1781)
|
|
25
|
+
- Add CI check to add changelog entry (Manuel Trezza) [#1764](https://github.com/parse-community/parse-dashboard/pull/1764)
|
|
26
|
+
- Refactor: uniform issue templates across repos (Manuel Trezza) [#1767](https://github.com/parse-community/parse-dashboard/pull/1767)
|
|
27
|
+
- fix: date cell value not selected on double clicks (fn-faisal) [#1730](https://github.com/parse-community/parse-dashboard/pull/1730)
|
|
28
|
+
|
|
29
|
+
## Fixes
|
|
30
|
+
- Fixed bug after creating new class, wrong CLP was shown for that class [#1784](https://github.com/parse-community/parse-dashboard/issues/1784) (Prerna Mehra) [#1785](https://github.com/parse-community/parse-dashboard/pull/1785)
|
|
31
|
+
- Fixed bug when opening a big modal, modal content is not visible due to Sidebar (Prerna Mehra) [#1777](https://github.com/parse-community/parse-dashboard/pull/1778)
|
|
32
|
+
- Fixed UI for a field containing an array of pointers (Prerna Mehra) [#1776](https://github.com/parse-community/parse-dashboard/pull/1776)
|
|
33
|
+
- Fixed bug when editing or copying a field containing an array of pointers [#1770](https://github.com/parse-community/parse-dashboard/issues/1770) (Prerna Mehra) [#1771](https://github.com/parse-community/parse-dashboard/pull/1771)
|
|
34
|
+
- Modernize CI (Manuel Trezza) [#1789](https://github.com/parse-community/parse-dashboard/pull/1789)
|
|
35
|
+
- ci: Remove parse-server dev dependency (Manuel Trezza) [#1796](https://github.com/parse-community/parse-dashboard/pull/1796)
|
|
36
|
+
|
|
37
|
+
# 2.2.0
|
|
38
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.1.0...2.2.0)
|
|
39
|
+
|
|
40
|
+
## New Features
|
|
41
|
+
- Added data export in CSV format for classes (Cory Imdieke, Manuel Trezza) [#1494](https://github.com/parse-community/parse-dashboard/pull/1494)
|
|
42
|
+
- Added collapsing sidebar for small screens (Douglas Muraoka, Manuel Trezza) [#1760](https://github.com/parse-community/parse-dashboard/pull/1760)
|
|
43
|
+
- Added exclude hidden columns from being fetched from server (itzharDev) [#1694](https://github.com/parse-community/parse-dashboard/pull/1694)
|
|
44
|
+
- Added cloning rows (Prerna Mehra) [#1697](https://github.com/parse-community/parse-dashboard/pull/1697)
|
|
45
|
+
- Added `Cmd`-click on pointer to open link in new browser tab (fn-faisal) [#1757](https://github.com/parse-community/parse-dashboard/pull/1757)
|
|
46
|
+
- Added browsing as another user (Nino Črljenec, Manuel Trezza) [#1750](https://github.com/parse-community/parse-dashboard/pull/1750)
|
|
47
|
+
- Added `columnPreference.preventSort` configuration option to prevent a column from being used for sorting (Christopher Brookes) [#1709](https://github.com/parse-community/parse-dashboard/pull/1709)
|
|
48
|
+
- Added `columnPreference` configuration option for data browser (dblythy) [#1625](https://github.com/parse-community/parse-dashboard/pull/1625)
|
|
49
|
+
|
|
50
|
+
## Improvements
|
|
51
|
+
- Improved navigation by redesigning pointer cell with link icon (Prerna Mehra) [#1708](https://github.com/parse-community/parse-dashboard/pull/1708)
|
|
52
|
+
- Improved rendering an array of pointers in cell (fn-faisal) [#1727](https://github.com/parse-community/parse-dashboard/pull/1727)
|
|
53
|
+
- Improved flow when creating a class and adding columns (fn-faisal) [#1728](https://github.com/parse-community/parse-dashboard/pull/1728)
|
|
54
|
+
- Added indication of required fields when adding new row (Prerna Mehra) [#1720](https://github.com/parse-community/parse-dashboard/pull/1720)
|
|
55
|
+
- Added indication of auto-populated fields when adding new row (Prerna Mehra) [#1692](https://github.com/parse-community/parse-dashboard/pull/1692)
|
|
56
|
+
- Added cancel button while adding a new row (Prerna Mehra) [#1690](https://github.com/parse-community/parse-dashboard/pull/1690)
|
|
57
|
+
- Added progress indicator when uploading a file in modal dialog (Prerna Mehra) [#1717](https://github.com/parse-community/parse-dashboard/pull/1717)
|
|
58
|
+
- Added tooltip for read-only fields (Prerna Mehra) [#1688](https://github.com/parse-community/parse-dashboard/pull/1688)
|
|
59
|
+
- Added message when no locale is set for localizing push notifications (Prerna Mehra) [#1685](https://github.com/parse-community/parse-dashboard/pull/1685)
|
|
60
|
+
- Updated to Parse JS SDK 3.3.0 (Manuel Trezza) [#1745](https://github.com/parse-community/parse-dashboard/pull/1745)
|
|
61
|
+
- Transitioned CI to GitHub Actions (Diamond Lewis) [#1640](https://github.com/parse-community/parse-dashboard/pull/1640)
|
|
62
|
+
- Added finish date to Cloud Job status (Diamond Lewis) [#1620](https://github.com/parse-community/parse-dashboard/pull/1620)
|
|
63
|
+
|
|
64
|
+
## Fixes
|
|
65
|
+
- Fixed clear state.data when setting relation to prevent column type mismatch (John Dillick) [#1564](https://github.com/parse-community/parse-dashboard/pull/1564)
|
|
66
|
+
- Fixed incorrect setting of pointer CLPs (mess-lelouch) [#1556](https://github.com/parse-community/parse-dashboard/pull/1556)
|
|
67
|
+
- Fixed master key not being passed in when saving file in global config (stevestencil) [#1581](https://github.com/parse-community/parse-dashboard/pull/1581)
|
|
68
|
+
- Fixes toolbar overlap to page title (Sergei Smirnov) [#1578](https://github.com/parse-community/parse-dashboard/pull/1578)
|
|
69
|
+
- Fixed various issues with edit row dialog (Nino Črljenec) [#1586](https://github.com/parse-community/parse-dashboard/pull/1586)
|
|
70
|
+
- Fixed date filters in data browser (Prerna Mehra) [#1682](https://github.com/parse-community/parse-dashboard/pull/1682)
|
|
71
|
+
- Fixed `expiresAt` field in `Session` class not appearing as read-only (Prerna Mehra) [#1686](https://github.com/parse-community/parse-dashboard/pull/1686)
|
|
72
|
+
- Fixed missing error message on failed clone row task (Prerna Mehra) [#1687](https://github.com/parse-community/parse-dashboard/pull/1687)
|
|
73
|
+
- Fixes missing or duplicate rows displayed when scrolling; this fix may require the additional creation of database indices to avoid performance issues, see PR discussion (Prerna Mehra) [#1706](https://github.com/parse-community/parse-dashboard/pull/1706)
|
|
74
|
+
- Fixed missing key binding for copy, paste, cancel while adding a new row (Christopher Brookes) [#1714](https://github.com/parse-community/parse-dashboard/pull/1714)
|
|
75
|
+
- Fixed setup locales message when adding all locales to push notification (Prerna Mehra) [#1691](https://github.com/parse-community/parse-dashboard/pull/1691)
|
|
76
|
+
- Fixed no error message displayed when trying to add column with a name that has a leading number (Prerna Mehra) [#1718](https://github.com/parse-community/parse-dashboard/pull/1718)
|
|
77
|
+
- Fixed fetching data when un-hiding column despite that data is already cached (Prerna Mehra) [#1734](https://github.com/parse-community/parse-dashboard/pull/1734)
|
|
78
|
+
- Fixed incorrect documentation (Philipp B) [#1592](https://github.com/parse-community/parse-dashboard/pull/1592)
|
|
79
|
+
- Fixed various dependency vulnerabilities
|
|
80
|
+
|
|
81
|
+
# 2.1.0
|
|
82
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.5...2.1.0)
|
|
83
|
+
|
|
84
|
+
__New features:__
|
|
85
|
+
* Added JS Console to run custom queries ([#1464](https://github.com/parse-community/parse-dashboard/pull/1464)), thanks to [Pedro Mutter](https://github.com/MutterPedro).
|
|
86
|
+
* View/Edit single row modal ([#1448](https://github.com/parse-community/parse-dashboard/pull/1448)), thanks to [NIno Črljenec](https://github.com/NinoZX).
|
|
87
|
+
* Context menu with quick filters and links to related records in other Parse Objects ([#1431](https://github.com/parse-community/parse-dashboard/pull/1431)), thanks to [404-html](https://github.com/404-html).
|
|
88
|
+
* Add ProtectedFields dialog and enhance Permissions dialogs ([#1478](https://github.com/parse-community/parse-dashboard/pull/1478)), thanks to [Old Grandpa](https://github.com/BufferUnderflower).
|
|
89
|
+
|
|
90
|
+
__Improvements:__
|
|
91
|
+
* Added config param delete confirmation dialog ([#1443](https://github.com/parse-community/parse-dashboard/pull/1443)), thanks to [Manuel Trezza](https://github.com/mtrezza).
|
|
92
|
+
|
|
93
|
+
__Fixes:__
|
|
94
|
+
* Inifite scroll not working ([#1432](https://github.com/parse-community/parse-dashboard/pull/1432)), thanks to [Douglas Muraoka](https://github.com/douglasmuraoka).
|
|
95
|
+
* Fix crash in import semver re: npm/node-semver#305 ([#1441](https://github.com/parse-community/parse-dashboard/pull/1441)), thanks to [Ben Petty](https://github.com/benpetty).
|
|
96
|
+
* Taking hidden columns into account when calculating Editor position ([#1438](https://github.com/parse-community/parse-dashboard/pull/1438)), thanks to [404-html](https://github.com/404-html).
|
|
97
|
+
* Fix audience conditions when Installation class does not exist ([#1451](https://github.com/parse-community/parse-dashboard/pull/1451)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo).
|
|
98
|
+
|
|
99
|
+
### 2.0.5
|
|
100
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.4...2.0.5)
|
|
101
|
+
* Fix: delete and regenerate package-lock to fix broken build
|
|
102
|
+
|
|
103
|
+
### 2.0.4
|
|
104
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.3...2.0.4)
|
|
105
|
+
* Fix: Restore `ObjectId` to filter ([#1315](https://github.com/parse-community/parse-dashboard/pull/1315)), thanks to [Wolfwood](https://github.com/W0lfw00d)
|
|
106
|
+
* Fix: Prevent duplicate entries when sorting by `createdAt` ([#1334](https://github.com/parse-community/parse-dashboard/pull/1334)), thanks to [Wolfwood](https://github.com/W0lfw00d)
|
|
107
|
+
|
|
108
|
+
### 2.0.3
|
|
109
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.2...2.0.3)
|
|
110
|
+
* Fix: Feature "masterkey parameters" requires Parse Server >= 3.9.0 ([#1281](https://github.com/parse-community/parse-dashboard/pull/1281)), thanks to [Manuel Trezza](https://github.com/mtrezza)
|
|
111
|
+
* Fix: CLP dialog for pointer fields ([#1283](https://github.com/parse-community/parse-dashboard/pull/1283)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
112
|
+
* Fix: Force pointer array items to always be pointers ([#1291](https://github.com/parse-community/parse-dashboard/pull/1291)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
113
|
+
|
|
114
|
+
### 2.0.2
|
|
115
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.1...2.0.2)
|
|
116
|
+
* Fix: filter tab not working for _User, and ohter classes starting with _ ([#1275](https://github.com/parse-community/parse-dashboard/pull/1275)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
117
|
+
* Fix: Data Browser is not updating accordingly ([#1276](https://github.com/parse-community/parse-dashboard/pull/1276)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
118
|
+
* NEW: Copy cell value using CTRL+C ([#1272](https://github.com/parse-community/parse-dashboard/pull/1272)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
119
|
+
* Docs: Update NodeJS required version in README ([#1265](https://github.com/parse-community/parse-dashboard/pull/1265)), thanks to [Jerome](https://github.com/JeromeDeLeon)
|
|
120
|
+
|
|
121
|
+
### 2.0.1
|
|
122
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/2.0.0...2.0.1)
|
|
123
|
+
* Publishing it again since there is an old test 2.0.0 release already published to npm
|
|
124
|
+
|
|
125
|
+
### 2.0.0
|
|
126
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.4.3...2.0.0)
|
|
127
|
+
* Fix: Cell edit not updating partial view ([#1255](https://github.com/parse-community/parse-dashboard/pull/1255)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
128
|
+
* Improve: Table performance improvements ([#1241](https://github.com/parse-community/parse-dashboard/pull/1241)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
129
|
+
* Fix: Avoid filter tab disappears on apply filter ([#1229](https://github.com/parse-community/parse-dashboard/pull/1229)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
130
|
+
* NEW: Change columns order and visibility ([#1235](https://github.com/parse-community/parse-dashboard/pull/1235)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
131
|
+
* Improve: Table not scrolling when using arrow keys ([#1239](https://github.com/parse-community/parse-dashboard/pull/1239)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
132
|
+
* NEW: Add masterkey parameters ([#1233](https://github.com/parse-community/parse-dashboard/pull/1233)), thanks to [Manuel](https://github.com/mtrezza)
|
|
133
|
+
* Improve: Editing values not possible on mobile ([#1222](https://github.com/parse-community/parse-dashboard/pull/1222)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
134
|
+
* Fix: JSON conversion breaking file upload process ([#1225](https://github.com/parse-community/parse-dashboard/pull/1225)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
135
|
+
* NEW: Support building on Windows ([#1115](https://github.com/parse-community/parse-dashboard/pull/1115)), thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
136
|
+
* Improve: Avoid Parse transformations on array and object fields ([#1223](https://github.com/parse-community/parse-dashboard/pull/1223)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
137
|
+
* NEW: Select all objects ([#1219](https://github.com/parse-community/parse-dashboard/pull/1219)), thanks to [Douglas Muaroka](https://github.com/douglasmuraoka)
|
|
138
|
+
* NEW: Boolean dropdown on installation condition ([#1221](https://github.com/parse-community/parse-dashboard/pull/1221)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
139
|
+
* NEW: String editor resizable ([#1217](https://github.com/parse-community/parse-dashboard/pull/1217)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
140
|
+
* Fix: Update PIG examples to work with react-dnd 3.x ([#1214](https://github.com/parse-community/parse-dashboard/pull/1214)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
141
|
+
* Fix: Fonts on AppsIndex ([#1197](https://github.com/parse-community/parse-dashboard/pull/1197)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
142
|
+
* NEW: Add required and default value options ([#1193](https://github.com/parse-community/parse-dashboard/pull/1193)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
143
|
+
|
|
144
|
+
#### Breaking Changes:
|
|
145
|
+
* Parse Dashboard now requires Node.js version >= 8.9
|
|
146
|
+
|
|
147
|
+
### 1.4.3
|
|
148
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.4.2...1.4.3)
|
|
149
|
+
* Fix 1.4.2 release.
|
|
150
|
+
|
|
151
|
+
### 1.4.2
|
|
152
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.4.1...1.4.2)
|
|
153
|
+
* Feature: Include count CLP option ([#1180](https://github.com/parse-community/parse-dashboard/pull/1180)), thanks to [Douglas Muroaka](https://github.com/douglasmuraoka)
|
|
154
|
+
* Fix: AppsMenu broken layout when app name is too long ([#1164](https://github.com/parse-community/parse-dashboard/pull/1164)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
155
|
+
* Fix: getFileName lib to display correctly the filename ([#1154](https://github.com/parse-community/parse-dashboard/pull/1154)), thanks to [Yago Tomé](https://github.com/yagotome)
|
|
156
|
+
* Fix: Scroll is not working properly ([#1151](https://github.com/parse-community/parse-dashboard/pull/1151)), thanks to [Lucas Alencar](https://github.com/alencarlucas)
|
|
157
|
+
* Fix: AppsMenu not closing after selecting app ([#1146](https://github.com/parse-community/parse-dashboard/pull/1146)), thanks to [Douglas Muroaka](https://github.com/douglasmuraoka)
|
|
158
|
+
* Feature: Add client key into GraphQL console by default ([#1142](https://github.com/parse-community/parse-dashboard/pull/1142)), thanks to [Douglas Muroaka](https://github.com/douglasmuraoka)
|
|
159
|
+
* Fix: GraphQL console headers menu not visible ([#1141](https://github.com/parse-community/parse-dashboard/pull/1141)), thanks to [Douglas Muroaka](https://github.com/douglasmuraoka)
|
|
160
|
+
* Fix: project not installing due to package-lock ([#1143](https://github.com/parse-community/parse-dashboard/pull/1143)), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
161
|
+
|
|
162
|
+
### 1.4.1
|
|
163
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.4.0...1.4.1)
|
|
164
|
+
* Fix: 1.4.0 failed to deploy to npm. Reset credentials and trying again.
|
|
165
|
+
|
|
166
|
+
### 1.4.0
|
|
167
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.3.3...1.4.0)
|
|
168
|
+
* Security Fix: see the [advisory](https://github.com/parse-community/parse-dashboard/network/alert/package-lock.json/lodash/open) for details. [22d748](https://github.com/parse-community/parse-dashboard/pull/1134/commits/22d748fdc1e95661dc39226f5f797dc8fb0e5c2f)
|
|
169
|
+
* Feature: GraphQL API playground ([#1123](https://github.com/parse-community/parse-dashboard/pull/1123)), thanks to [Douglas Muraoka](https://github.com/douglasmuraoka)
|
|
170
|
+
* Fix: Can't switch (dropdown list) between servers [#1045](https://github.com/parse-community/parse-dashboard/issues/1045) ([#1125](https://github.com/parse-community/parse-dashboard/pull/1125)), thanks to [Douglas Muraoka](https://github.com/douglasmuraoka)
|
|
171
|
+
|
|
172
|
+
### 1.3.3
|
|
173
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.3.2...1.3.3)
|
|
174
|
+
|
|
175
|
+
* FIX: Travis configuration which was preventing 1.3.2 from publishing, thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
176
|
+
|
|
177
|
+
### 1.3.2
|
|
178
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.3.1...1.3.2)
|
|
179
|
+
|
|
180
|
+
* FIX: Dockerhub configuration which was preventing 1.3.1 from publishing ([#1098](https://github.com/parse-community/parse-dashboard/pull/1098)), thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
181
|
+
|
|
182
|
+
### 1.3.1
|
|
183
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.3.0...1.3.1)
|
|
184
|
+
|
|
185
|
+
* FIX: Correct inappropriate error message when no target audience is selected ([#1052](https://github.com/parse-community/parse-dashboard/pull/1052)), thanks to [Bouimadaghene](https://github.com/starbassma)
|
|
186
|
+
* FIX: issue regarding lost mount path ([#1070](https://github.com/parse-community/parse-dashboard/pull/1070)), thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
187
|
+
* NEW: Add distinct / unique filter ([#920](https://github.com/parse-community/parse-dashboard/pull/920)), thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
188
|
+
|
|
189
|
+
### 1.3.0
|
|
190
|
+
[Full Changelog](https://github.com/parse-community/parse-dashboard/compare/1.2.0...1.3.0)
|
|
191
|
+
|
|
192
|
+
* Node 10 Support, thanks [Florent Vilmart](https://github.com/flovilmart)
|
|
193
|
+
* Fix: Remove column dialog default values (#969), thanks to [Jonas Stendahl](https://github.com/JStonevalley)
|
|
194
|
+
* Fix: Handle case of null in array (#922), thanks to [Abdullah Alsigar](https://github.com/agent3bood)
|
|
195
|
+
* Fix: JSON file upload (#935), thanks to [joshuadiezmo](https://github.com/joshuadiezmo)
|
|
196
|
+
* Fix: Set initial audience null (#910), thanks to [Paulo Reis](https://github.com/paulovitin)
|
|
197
|
+
* Fix: Ensure we traverse the payloadJSON properly (#861), thanks [Florent Vilmart](https://github.com/flovilmart)
|
|
198
|
+
* Improvements: Push Audiences (#813), thanks [Florent Vilmart](https://github.com/flovilmart)
|
|
199
|
+
* Improvements: Docker Build
|
|
200
|
+
* Feature: `preventSchemaEdits` option (#960), thanks to [Cyril Chandelier](https://github.com/cyrilchandelier)
|
|
201
|
+
* Feature: Redirect to the first app browser when only a single app is registered (#958), thanks to [Cyril Chandelier](https://github.com/cyrilchandelier)
|
|
202
|
+
* Feature: Add classname to browser title (#913), thanks to [Paulo Reis](https://github.com/paulovitin)
|
|
203
|
+
* Feature: Support for Clone Object (#946), thanks to [Diamond Lewis](https://github.com/dplewis)
|
|
204
|
+
* Feature: Add tvOS support to push targeting (#936), thanks to [Thomas Kollbach](https://github.com/toto)
|
|
205
|
+
* Feature: When using username to login, display dashboard username (#800), thanks to [Abdullah Alsigar](https://github.com/agent3bood)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
### 1.2.0
|
|
209
|
+
* Fix: Filtering with a 1-digit number (#831), thanks to [Pascal Giguère](https://github.com/pgiguere1)
|
|
210
|
+
* Fix: Databrowser shows correct count of filtered objects, thanks to [Tom Engelbrecht](https://github.com/engel)
|
|
211
|
+
* Feature: Add primaryBackgroundColor and secondaryBackgroundColor in AppCard, thanks to [AreyouHappy](https://github.com/AreyouHappy)
|
|
212
|
+
* Improvement: Removes forcing sort on createdAt (#796), thanks to [Florent Vilmart](https://github.com/flovilmart)
|
|
213
|
+
* Fix: Broken Learn More link to cloud code documentation page (#828), thanks to [Stefan Trauth](https://github.com/funkenstrahlen)
|
|
214
|
+
* Fix: Add `_PushStatus` add to SpecialClasses (#701), thanks to [Dongwoo Gim](https://github.com/gimdongwoo)
|
|
215
|
+
* Fix: Include PushAudience query (#795), thanks to [marvelm](https://github.com/marvelm)
|
|
216
|
+
|
|
217
|
+
### 1.1.2
|
|
218
|
+
|
|
219
|
+
* Fix: An issue introduced when using readOnlyMasterKey would make all users readOnly after one has logged in.
|
|
220
|
+
* Reverts: Dependency updates that would render the build unstable / broken.
|
|
221
|
+
|
|
222
|
+
### 1.1.1
|
|
223
|
+
|
|
224
|
+
* Fix: Updating array of Dates now keeps it's type (was changing to array of ISO strings, issue #590), thanks to [David Riha](https://github.com/rihadavid)
|
|
225
|
+
* Fix: NaN displayed when filter input is empty or negative number (#749), thanks to [Miguel Serrrano](https://github.com/miguel-s)
|
|
226
|
+
* Fix: Addresses issue related to displaying iOS alert object containing title and body keys (#539), thanks to [Robert Martin del Campo](https://github.com/repertus)
|
|
227
|
+
* Feature: Adds support for localized push notifications if server version is high enough, thanks to [Florent Vilmart](https://github.com/flovilmart)
|
|
228
|
+
* Feature: Adds support for readOnly masterKey, thanks to [Florent Vilmart](https://github.com/flovilmart)
|
|
229
|
+
* Feature: Adds support for polygon types, thansk to [Mads Bjerre](https://github.com/madsb)
|
|
230
|
+
* Feature: Adds support for push time, expiration time, and expiration interval, thanks to [Marvel Mathew](https://github.com/marvelm)
|
|
231
|
+
|
|
232
|
+
### 1.1.0
|
|
233
|
+
|
|
234
|
+
* Feature: UI for managing push audiences (#712), thanks to [Davi Macedo](https://github.com/davimacedo)
|
|
235
|
+
* Feature: When editing Object or Array fields the data is displayed in a prettier format and the textarea is resizable (#734), thanks to [Samuli Siivinen](https://github.com/ssamuli)
|
|
236
|
+
* Fix: Display bug on safari when table has empty cells ('') (#731), thanks to [Samuli Siivinen](https://github.com/ssamuli)
|
|
237
|
+
* Fix: Added message that notifies Background Jobs requiring additional setup (#740 & #741), thanks to [Samuli Siivinen](https://github.com/ssamuli) and [Natan Rolnik](https://github.com/natanrolnik)
|
|
238
|
+
|
|
239
|
+
### 1.0.28
|
|
240
|
+
* Feature: Add ability to search Object columns (#727), thanks to [Samuli Siivinen](https://github.com/ssamuli)
|
|
241
|
+
* Improvement: Added/fixed a filtering option "contains string" for String fields. Case insensitive for now (#728), thanks to [Samuli Siivinen](https://github.com/ssamuli)
|
|
242
|
+
* Improvement: Sort config data according to parameter names (#726), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
243
|
+
|
|
244
|
+
### 1.0.27
|
|
245
|
+
* Improvement: Show notifications upon success or failure of save and delete objects (#718), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
246
|
+
* Improvement: Moves download option into file editor (#716), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
247
|
+
|
|
248
|
+
### 1.0.26
|
|
249
|
+
* Improvement: Fixes broken links, thanks to [Arthur Cinader](https://github.com/acinader)
|
|
250
|
+
* Improvement: Title on the add row button, thanks to [Abdul Basit](https://github.com/basitsattar)
|
|
251
|
+
* Improvement: Use slim docker image, thanks to [Tyler Brock](https://github.com/tbrock)
|
|
252
|
+
* Fix: table scrolling on google chrome (#671), thanks to [Jacer Omri](https://github.com/JacerOmri)
|
|
253
|
+
* Various: adds eslint, thanks to [Jeremy Louie](https://github.com/JeremyPlease)
|
|
254
|
+
|
|
255
|
+
### 1.0.25
|
|
256
|
+
|
|
257
|
+
* Improvement: Update and add links to sidebar footer (#661), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
258
|
+
* Fix: Don’t call unsupported endpoints in Parse Server (#660), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
259
|
+
* Fix: Display correctly Files and GeoPoints in Config (#666), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
260
|
+
|
|
261
|
+
### 1.0.24
|
|
262
|
+
|
|
263
|
+
* Improvement: Data browser updates object count when table is filtered (#652), thanks to [Mike Rizzo](https://github.com/rizzomichaelg)
|
|
264
|
+
* Improvement: Apps name sorting by name (#654), thanks to [Thilo Schmalfuß](https://github.com/scthi)
|
|
265
|
+
* Fix: Fetch jobs list not showing (#656), thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
266
|
+
|
|
267
|
+
### 1.0.23
|
|
268
|
+
|
|
269
|
+
* Improvement: Enabling web hooks (#584), thanks to [Antonio Davi Macedo Coelho de Castro](https://github.com/davimacedo)
|
|
270
|
+
* Improvement: Set autofocus on the username input field (#644), thanks to [Herman Liang](https://github.com/hermanliang)
|
|
271
|
+
* Fix: Browser won't render class table with field that contains an object (#623), thanks to [Jordan Haven](https://github.com/jordanhaven)
|
|
272
|
+
* Fix: Config FETCH results in 401 (#575), thanks to [Matt Simms](https://github.com/brndmg)
|
|
273
|
+
|
|
274
|
+
### 1.0.22
|
|
275
|
+
|
|
276
|
+
* Fix issue affecting logging screen with encrypted passwords, thanks to [lsohn](https://github.com/lsohn)
|
|
277
|
+
|
|
278
|
+
### 1.0.21
|
|
279
|
+
|
|
280
|
+
* Fix: Use mountPath for all log in and log out redirects
|
|
281
|
+
|
|
282
|
+
### 1.0.20
|
|
283
|
+
|
|
284
|
+
* New: Form based login page instead of basic auth (#562), thanks to [Jeremy Louie](https://github.com/JeremyPlease)
|
|
285
|
+
* Fix: Can't send push to specific user (#570), thanks to [Dan VanWinkle](https://github.com/dvanwinkle)
|
|
286
|
+
* Fix: Download link in footer menu (#567), thanks to [Pavel Ivanov](https://github.com/pivanov)
|
|
287
|
+
|
|
288
|
+
### 1.0.19
|
|
289
|
+
|
|
290
|
+
* New: Support for trusting proxies w/ HTTPS
|
|
291
|
+
* New: Support for filtering string with `ends with`
|
|
292
|
+
* New: View parse-server based jobs
|
|
293
|
+
* New: Button to add rows from browser toolbar
|
|
294
|
+
* New: Support for encrypted passwords
|
|
295
|
+
* New: Support for sorting by `createdAt`
|
|
296
|
+
* Improvement: Push audiences support
|
|
297
|
+
* Fix: Calendar dates support
|
|
298
|
+
|
|
299
|
+
### 1.0.18
|
|
300
|
+
|
|
301
|
+
* Fix: Revert history change that was causing issues when mounting on express
|
|
302
|
+
|
|
303
|
+
### 1.0.17
|
|
304
|
+
|
|
305
|
+
* Fix: Revert mount path change that was causing issues when mounting on express
|
|
306
|
+
|
|
307
|
+
### 1.0.16
|
|
308
|
+
|
|
309
|
+
* New: Add options to add selected rows to a relation, thanks to [Han BaHwan](https://github.com/Beingbook)
|
|
310
|
+
* New: Add ability to use bcrypted passwords, thanks to [Dan VanWinkle](https://github.com/dvanwinkle)
|
|
311
|
+
* Fix: Fix deletion of columns, thanks to [Bryan Rhea](https://github.com/brheal)
|
|
312
|
+
|
|
313
|
+
### 1.0.15
|
|
314
|
+
|
|
315
|
+
* New: Add ability to delete all rows in a class, thanks to [Marco Cheung](https://github.com/Marco129)
|
|
316
|
+
* New: Add relation editor, thanks to [Han BaHwan](https://github.com/Beingbook)
|
|
317
|
+
* Fix: Bug when alert is missing in payload, thanks to [Herman Liang](https://github.com/hermanliang)
|
|
318
|
+
* Fix: Improve target display in Push viewer, thanks to [Herman Liang](https://github.com/hermanliang)
|
|
319
|
+
* Fix: Open docs and other sidebar links in new tab, thanks to [Konstantinos N.](https://github.com/kwstasna)
|
|
320
|
+
|
|
321
|
+
### 1.0.14
|
|
322
|
+
|
|
323
|
+
* Fix bug in past push page
|
|
324
|
+
|
|
325
|
+
### 1.0.13
|
|
326
|
+
|
|
327
|
+
* Fix log retrieval, thanks to [Jérémy Thiry](https://github.com/poltib)
|
|
328
|
+
* Improved GeoPoint editor and ESC button in editors, thanks to [Sam Schooler](https://github.com/samschooler)
|
|
329
|
+
* Add push status page to dashboard, thanks to [Jeremy Pease](https://github.com/JeremyPlease)
|
|
330
|
+
|
|
331
|
+
### 1.0.12
|
|
332
|
+
|
|
333
|
+
* Fix minor style issues
|
|
334
|
+
* Add pointer permissions editor
|
|
335
|
+
* Allow cancellation of edits in data browser using ESC key, thanks to [Manuel](https://github.com/mtrezza)
|
|
336
|
+
* Show error messages in the console when your app's icons can't be found, thanks to [Saif Al-Dilaimi](https://github.com/deada92)
|
|
337
|
+
|
|
338
|
+
### 1.0.11
|
|
339
|
+
|
|
340
|
+
* Add the ability to specify SSL cert and key, thanks to [Cory Imdieke](https://github.com/Vortec4800)
|
|
341
|
+
* Trust proxy when enabling --allowInsecureHTTP, thanks to [Andrew Chen](https://github.com/yongjhih)
|
|
342
|
+
* Fix App index when apps have an apostrophe in the name
|
|
343
|
+
* Fix display of prod/dev flag
|
|
344
|
+
* Support for Node 6
|
|
345
|
+
|
|
346
|
+
### 1.0.10
|
|
347
|
+
|
|
348
|
+
* Add the ability to specify icons for your app, thanks to [Natan Rolnik](https://github.com/natanrolnik)
|
|
349
|
+
* Fix sending push with JSON data
|
|
350
|
+
|
|
351
|
+
### 1.0.9
|
|
352
|
+
|
|
353
|
+
* Add the ability to mount the dashboard express app on a custom mount path, thanks to [hpello](https://github.com/hpello) with bugfixes from [mamaso](https://github.com/mamaso)
|
|
354
|
+
* Add ability to restrict certain users to certain apps, thanks to [Felipe Andrade](https://github.com/felipemobile)
|
|
355
|
+
* Fix Dockerfile, thanks to [Kakashi Liu](https://github.com/kkc)
|
|
356
|
+
* Display Parse Dashboard version, thanks to [Aayush Kapoor](https://github.com/xeoneux) and [gateway](https://github.com/gateway)
|
|
357
|
+
* Add a refresh button to the data browser, thanks to [TylerBrock](https://github.com/TylerBrock)
|
|
358
|
+
* Add logs viewer
|
|
359
|
+
* Misc. performance improvements and bugfixes, thanks to [Pavel Ivanov](https://github.com/pivanov)
|
|
360
|
+
|
|
361
|
+
### 1.0.8
|
|
362
|
+
|
|
363
|
+
* Allow Dashboard to be mounted as Express middleware, thanks to [Florent Vilmart](https://github.com/flovilmart)
|
|
364
|
+
* Add an option to specify that your app is in production, thanks to [Dylan Diamond](https://github.com/dcdspace)
|
|
365
|
+
* Fix GeoPoints in Parse Config, thanks to [Dylan Diamond](https://github.com/dcdspace)
|
|
366
|
+
* Allow specification of the host the dashboard runs on, thanks to [hpello](https://github.com/hpello)
|
|
367
|
+
* Miscellaneous look-and-feel improvements
|
|
368
|
+
|
|
369
|
+
### 1.0.7
|
|
370
|
+
|
|
371
|
+
* Fix sending pushes with badge increment
|
|
372
|
+
|
|
373
|
+
### 1.0.6
|
|
374
|
+
|
|
375
|
+
* Send push notifications from the dashboard
|
|
376
|
+
* Add object count to relation browser, thanks to [Sergey Gavrilyuk](https://github.com/gavrix)
|
|
377
|
+
|
|
378
|
+
### 1.0.5
|
|
379
|
+
|
|
380
|
+
* Fix new features notification
|
|
381
|
+
|
|
382
|
+
### 1.0.4
|
|
383
|
+
|
|
384
|
+
* Class level permissions editor
|
package/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
For Parse Dashboard software
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2015-Present, Parse, LLC. All rights reserved.
|
|
6
|
+
|
|
7
|
+
Parse, LLC. ("Parse") owns all right, title and interest, including all
|
|
8
|
+
intellectual property and other proprietary rights, in and to the Parse Dashboard
|
|
9
|
+
software (the "Software"). Subject to your compliance with these terms, you are
|
|
10
|
+
hereby granted a non-exclusive, worldwide, royalty-free copyright license to
|
|
11
|
+
(1) use and copy the Software; and (2) reproduce and distribute the Software as part
|
|
12
|
+
of your own software ("Your Software"), provided Your Software does not consist
|
|
13
|
+
solely of the Software; and (3) modify the Software for your own internal use.
|
|
14
|
+
Parse reserves all rights not expressly granted to you in this license agreement.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS OR
|
|
17
|
+
IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
|
19
|
+
IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR EMPLOYEES
|
|
20
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
21
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
22
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
23
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
24
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
25
|
+
IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
26
|
+
OF SUCH DAMAGE.
|
|
27
|
+
|
|
28
|
+
-----
|
|
29
|
+
|
|
30
|
+
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var bcrypt = require('bcryptjs');
|
|
3
|
+
var csrf = require('csurf');
|
|
4
|
+
var passport = require('passport');
|
|
5
|
+
var LocalStrategy = require('passport-local').Strategy;
|
|
6
|
+
const OTPAuth = require('otpauth')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Constructor for Authentication class
|
|
10
|
+
*
|
|
11
|
+
* @class Authentication
|
|
12
|
+
* @param {Object[]} validUsers
|
|
13
|
+
* @param {boolean} useEncryptedPasswords
|
|
14
|
+
*/
|
|
15
|
+
function Authentication(validUsers, useEncryptedPasswords, mountPath) {
|
|
16
|
+
this.validUsers = validUsers;
|
|
17
|
+
this.useEncryptedPasswords = useEncryptedPasswords || false;
|
|
18
|
+
this.mountPath = mountPath;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function initialize(app, options) {
|
|
22
|
+
options = options || {};
|
|
23
|
+
var self = this;
|
|
24
|
+
passport.use('local', new LocalStrategy(
|
|
25
|
+
{passReqToCallback:true},
|
|
26
|
+
function(req, username, password, cb) {
|
|
27
|
+
var match = self.authenticate({
|
|
28
|
+
name: username,
|
|
29
|
+
pass: password,
|
|
30
|
+
otpCode: req.body.otpCode
|
|
31
|
+
});
|
|
32
|
+
if (!match.matchingUsername) {
|
|
33
|
+
return cb(null, false, { message: 'Invalid username or password' });
|
|
34
|
+
}
|
|
35
|
+
if (match.otpMissing) {
|
|
36
|
+
return cb(null, false, { message: 'Please enter your one-time password.' });
|
|
37
|
+
}
|
|
38
|
+
if (!match.otpValid) {
|
|
39
|
+
return cb(null, false, { message: 'Invalid one-time password.' });
|
|
40
|
+
}
|
|
41
|
+
cb(null, match.matchingUsername);
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
passport.serializeUser(function(username, cb) {
|
|
46
|
+
cb(null, username);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
passport.deserializeUser(function(username, cb) {
|
|
50
|
+
var user = self.authenticate({
|
|
51
|
+
name: username
|
|
52
|
+
}, true);
|
|
53
|
+
cb(null, user);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var cookieSessionSecret = options.cookieSessionSecret || require('crypto').randomBytes(64).toString('hex');
|
|
57
|
+
app.use(require('connect-flash')());
|
|
58
|
+
app.use(require('body-parser').urlencoded({ extended: true }));
|
|
59
|
+
app.use(require('cookie-session')({
|
|
60
|
+
key : 'parse_dash',
|
|
61
|
+
secret : cookieSessionSecret,
|
|
62
|
+
cookie : {
|
|
63
|
+
maxAge: (2 * 7 * 24 * 60 * 60 * 1000) // 2 weeks
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
app.use(passport.initialize());
|
|
67
|
+
app.use(passport.session());
|
|
68
|
+
|
|
69
|
+
app.post('/login',
|
|
70
|
+
csrf(),
|
|
71
|
+
passport.authenticate('local', {
|
|
72
|
+
successRedirect: `${self.mountPath}apps`,
|
|
73
|
+
failureRedirect: `${self.mountPath}login`,
|
|
74
|
+
failureFlash : true
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
app.get('/logout', function(req, res){
|
|
79
|
+
req.logout();
|
|
80
|
+
res.redirect(`${self.mountPath}login`);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Authenticates the `userToTest`
|
|
86
|
+
*
|
|
87
|
+
* @param {Object} userToTest
|
|
88
|
+
* @returns {Object} Object with `isAuthenticated` and `appsUserHasAccessTo` properties
|
|
89
|
+
*/
|
|
90
|
+
function authenticate(userToTest, usernameOnly) {
|
|
91
|
+
let appsUserHasAccessTo = null;
|
|
92
|
+
let matchingUsername = null;
|
|
93
|
+
let isReadOnly = false;
|
|
94
|
+
let otpMissing = false;
|
|
95
|
+
let otpValid = true;
|
|
96
|
+
|
|
97
|
+
//they provided auth
|
|
98
|
+
let isAuthenticated = userToTest &&
|
|
99
|
+
//there are configured users
|
|
100
|
+
this.validUsers &&
|
|
101
|
+
//the provided auth matches one of the users
|
|
102
|
+
this.validUsers.find(user => {
|
|
103
|
+
let isAuthenticated = false;
|
|
104
|
+
let usernameMatches = userToTest.name == user.user;
|
|
105
|
+
if (usernameMatches && user.mfa && !usernameOnly) {
|
|
106
|
+
if (!userToTest.otpCode) {
|
|
107
|
+
otpMissing = true;
|
|
108
|
+
} else {
|
|
109
|
+
const totp = new OTPAuth.TOTP({
|
|
110
|
+
algorithm: user.mfaAlgorithm || 'SHA1',
|
|
111
|
+
secret: OTPAuth.Secret.fromBase32(user.mfa)
|
|
112
|
+
});
|
|
113
|
+
const valid = totp.validate({
|
|
114
|
+
token: userToTest.otpCode
|
|
115
|
+
});
|
|
116
|
+
if (valid === null) {
|
|
117
|
+
otpValid = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
let passwordMatches = this.useEncryptedPasswords && !usernameOnly ? bcrypt.compareSync(userToTest.pass, user.pass) : userToTest.pass == user.pass;
|
|
122
|
+
if (usernameMatches && (usernameOnly || passwordMatches)) {
|
|
123
|
+
isAuthenticated = true;
|
|
124
|
+
matchingUsername = user.user;
|
|
125
|
+
// User restricted apps
|
|
126
|
+
appsUserHasAccessTo = user.apps || null;
|
|
127
|
+
isReadOnly = !!user.readOnly; // make it true/false
|
|
128
|
+
}
|
|
129
|
+
return isAuthenticated;
|
|
130
|
+
}) ? true : false;
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
isAuthenticated,
|
|
134
|
+
matchingUsername,
|
|
135
|
+
otpMissing,
|
|
136
|
+
otpValid,
|
|
137
|
+
appsUserHasAccessTo,
|
|
138
|
+
isReadOnly,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Authentication.prototype.initialize = initialize;
|
|
143
|
+
Authentication.prototype.authenticate = authenticate;
|
|
144
|
+
|
|
145
|
+
module.exports = Authentication;
|