|
7 | 7 |
|
8 | 8 | "use strict";
|
9 | 9 |
|
| 10 | +import MongoStorageAdapter from '../src/Adapters/Storage/Mongo/MongoStorageAdapter'; |
10 | 11 | const request = require('request');
|
11 | 12 | const passwordCrypto = require('../src/password');
|
12 | 13 | const Config = require('../src/Config');
|
@@ -239,6 +240,41 @@ describe('Parse.User testing', () => {
|
239 | 240 | });
|
240 | 241 | });
|
241 | 242 |
|
| 243 | + it_only_db('mongo')('should let legacy users without ACL login', async() => { |
| 244 | + const databaseURI = 'mongodb://localhost:27017/parseServerMongoAdapterTestDatabase'; |
| 245 | + const adapter = new MongoStorageAdapter({ collectionPrefix: 'test_', uri: databaseURI }); |
| 246 | + await adapter.connect(); |
| 247 | + await adapter.database.dropDatabase(); |
| 248 | + delete adapter.connectionPromise; |
| 249 | + |
| 250 | + const user = new Parse.User(); |
| 251 | + await user.signUp({ |
| 252 | + username: 'newUser', |
| 253 | + password: 'password', |
| 254 | + }); |
| 255 | + |
| 256 | + const collection = await adapter._adaptiveCollection('_User'); |
| 257 | + await collection.insertOne({ |
| 258 | + // the hashed password is 'password' hashed |
| 259 | + "_hashed_password": "$2b$10$mJ2ca2UbCM9hlojYHZxkQe8pyEXe5YMg0nMdvP4AJBeqlTEZJ6/Uu", |
| 260 | + "_session_token": "xxx", |
| 261 | + |
| 262 | + "username": "oldUser", |
| 263 | + "emailVerified": true, |
| 264 | + "_email_verify_token": "yyy", |
| 265 | + }); |
| 266 | + |
| 267 | + // get the 2 users |
| 268 | + const users = await collection.find(); |
| 269 | + expect(users.length).toBe(2); |
| 270 | + |
| 271 | + const aUser = await Parse.User.logIn('oldUser', 'password'); |
| 272 | + expect(aUser).not.toBeUndefined(); |
| 273 | + |
| 274 | + const newUser = await Parse.User.logIn('newUser', 'password'); |
| 275 | + expect(newUser).not.toBeUndefined(); |
| 276 | + }); |
| 277 | + |
242 | 278 | it('should be let masterKey lock user out with authData', (done) => {
|
243 | 279 | let objectId;
|
244 | 280 | let sessionToken;
|
|
0 commit comments