Commit Graph

81 Commits

Author SHA1 Message Date
Florent Vilmart
72888bc539 Adds ability to login with email when specifying it (#4276)
* Adds ability to login with email when specifying it

* Adds tests for corner cases

* nits
2017-10-24 17:50:48 -04:00
Benjamin Wilson Friedman
0db858b04c Enables login over POST in addition to GET (#4268)
* Enables login over POST in addition to GET

* Removes explcit method:POST as rp.post does this naturally
2017-10-24 15:47:26 -04:00
Florent Vilmart
9de4b8b2a7 Refactors configuration management (#4271)
* Adds flow types / Configuration interfaces

* Lets call it options

* Use a single interface to generate the configurations

* Translates options to definitions only if comments are set

* improves logic

* Moves objects around

* Fixes issue affecting logging of circular objects

* fixes undefined env

* Moves all defaults to defaults

* Adds back CLI defaults

* Restored defaults in commander.js

* Merge provided defaults and platform defaults

* Addresses visual nits

* Improves Config.js code

* Adds ability to pass the default value in trailing comments

* Load platform defaults from the definitions file

* proper default values on various options

* Adds ParseServer.start and server.start(options) as quick startup methods

* Moves creating liveQueryServer http into ParseServer.js

* removes dead code

* Adds tests to guarantee we can start a LQ Server from main module

* Fixes incorrect code regading liveQuery init port

* Start a http server for LQ if port is specified

* ensure we dont fail if config.port is not set

* Specify port

* ignore other path skipped in tests

* Adds test for custom middleware setting

* Refactors new Config into Config.get

- Hides AppCache from ParseServer.js, use Config.put which validates

* Extracts controller creation into Controllers/index.js

- This makes the ParseServer init way simpler

* Move serverURL inference into ParseServer

* review nits
2017-10-23 08:43:05 -04:00
Florent Vilmart
839a117246 Fixes #2885 duplicate sessions (#4143)
* Adds test to repro the issue

* Improved test

* Destroy duplicate sessions for User/Installation-id pair

- Sessions will also be created with action login instead of signup when using 3rd party auth
2017-09-11 09:52:18 -04:00
Florent Vilmart
2e1ba66fd2 Fix/user update issue (#4123)
* Adds failing test,

the _User object is not updated as soon as you pass some authData part of the PUT

* Do not run the DB call when updating the user with new auth data, just part of the rest
2017-08-29 16:34:59 -04:00
Florent Vilmart
92d51def6b Fixes issue affecting linking users to a 3rd party auth (#4047)
* Fixes issue affecting linking users to a 3rd party auth

* Fixes problematic test

* Better fix

* nits
2017-07-25 15:26:34 -04:00
greenkeeper[bot]
e94991b368 Update dependencies to enable Greenkeeper 🌴 (#3940)
* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* Fix indent issues with eslint 4.0

see http://eslint.org/docs/user-guide/migrating-to-4.0.0\#-the-indent-rule-is-more-strict
2017-06-20 09:15:26 -07:00
Florent Vilmart
16954c2f74 fix(#3898): session token deletion (#3937)
* fix(#3898): session token deletion

* nits
2017-06-16 12:56:28 -04:00
Florent Vilmart
9256b2d7e6 chore: fix flaky test (#3928)
* logOut is async so handle with a promise
2017-06-13 23:54:15 -04:00
Antonio Davi Macedo Coelho de Castro
6cc99aa193 fix(Restwrite): Do not send verification email if users is authenticated using some auth provider (#2660) (#3882) 2017-05-29 20:06:40 -04:00
Florent Vilmart
73aafa2d24 fix(tests): Stabilize flaky tests (#3876)
* Longer TTL, shorter wait

* Makes sure we wait for the logout

- Parse.User.logOut is async and was making a test flaky
2017-05-28 20:01:33 -04:00
Florent Vilmart
57efd89b3d fix(AuthAdapters): Do not revalidate auth data if hasn't changed (#3867) (#3872)
* Adds test for #3867

* Always Skip authData validation when nothing is mutated
2017-05-28 17:50:16 -04:00
Florent Vilmart
17a2d269ef Always clear sessions when user password is updated (#3821)
* Adds repro to  issue #3289

* Always clear sessions when password is updated
2017-05-16 11:13:09 -07:00
Anthony Mosca
877ef78b5e Improve email verification (#3681)
* Removed hidden keys from users/me.

* Ensured that general users cannot update email verified flag.

* Updated tests to reflect email verification changes.
2017-05-11 09:44:58 -04:00
Florent Vilmart
45a9d50110 Skip authData validation if it hasn't changed. (#3783)
* Adds test for the new feature

* Re-validate authData only if mutated

- In case of short-lived tokens (like facebook) this will allow clients to be lax with asking users to re-login
2017-05-07 12:55:30 -04:00
Arthur Cinader
4cb6e7d209 Add lint rule space-infix-ops (#3237)
Disallows: 1+1.  Must be 1 + 1.
2017-01-11 12:31:40 -08:00
Arthur Cinader
ca286b7108 Enable prefer-const lint rule (#3202) 2016-12-07 18:17:05 -05:00
Arthur Cinader
37daafc7b0 Add strip whitespace and trailing eol to spec too. (#3159) 2016-12-01 21:45:49 -05:00
Florent Vilmart
8c2c76dd26 Adds liniting into the workflow (#3082)
* initial linting of src

* fix indent to 2 spaces

* Removes unnecessary rules

* ignore spec folder for now

* Spec linting

* Fix spec indent

* nits

* nits

* no no-empty rule
2016-11-24 15:47:41 -05:00
BAm Wang
58a2ee32fa Validate username password type when logging in, and validate email when reseting password (#2679)
* Validate username password type when logging in, and validate email when reset password

* Add test for validation
2016-09-09 11:24:33 -04:00
Florent Vilmart
9ab488b6a0 Postgres: $all, $and CLP and more (#2551)
* Adds passing tests

* Better containsAll implementation

* Full Geopoint support, fix inverted lat/lng

* Adds support for $and operator / PointerPermissions specs

* Fix issue updating CLPs on schema

* Extends query support

* Adds RestCreate to the specs

* Adds User specs

* Adds error handlers for failing tests

* nits

* Proper JSON update of AuthData

* fix for #1259 with PG

* Fix for Installations _PushStatus test

* Adds support for GlobalConfig

* Enables relations tests

* Exclude spec as legacy

* Makes corner case for 1 in GlobalConfig
2016-08-20 16:07:48 -04:00
Florent Vilmart
9ecb9a3595 Postgres: Operations, Hooks, OAuth login, Files support (#2528)
* Adds files related tests through fs-adapter with PG

* Schema deletions implementations

* Adds Hooks spec

* Fix test

* Adds support for containsAll (numbers and strings)

* Better support for deleteFields and deleteClass

* Recursive JSON update for authData

* Adds node_modules to travis cache

* Disable temporarily to make tests pass

* Adds _perishable_token support for _User class

* ignore when a table creation fails at init (table exists)

* Adds support for AddUnique and Remove

* PG 9.4 compatible functions

* Re-enable tests

* nit

* Better handling of schema creation race
2016-08-18 18:05:26 -04:00
Florent Vilmart
c0249283ac Advancements with postgres (#2510)
* Start DB runner from tests

* Connect GridstoreAdapter only when needed

* removes unused package

* better test errors reporting

* Adds support for __op.Delete

* Better test error reporting

* Makes sure all tests can run without crashing

* Use xdescribe to skip test suite

* Removes unused dependencies

* Let volatiles classes be created with PG on start

* Do not fail if class dont exist

* adds index.spec.js to the pg suite

* Use a new config each test to prevent side effects

* Enable EmailVerificationToken specs with pg

* Makes sure failure output is not cut

* Reduces number of ignored tests in ParseObject.spec

* Inspect reconfiguration errors

* Mark GlobalConfig is incompatible with PG

- Problem is with nested updates (param.prop = value)

* PG: Nested JSON queries and updates

- Adds support for nested json and . operator queries
- Adds debug support for PG adapter
- Adds loglevel support in helper

* Enable working specs in ParseUser

* Sets default logLevel in tests to undefined

* Adds File type support, retores purchaseValidation specs

* Adds support for updating jsonb objects

- Restores PushController tests

* Proper implementation of deleteByQuery and ORs

- Adds ParseInstallation spec to the test suite

* xit only failing tests

* Nit on ParseAPI spec

* add sorting operator

* properly bound order keys

* reverts describe_only_db behavior

* Enables passing tests

* Adds basic support for relations, upsertOneObject aliased to createObject

* progress on queries options

* Fix ACL update related problems

* Creates relation tables on class creation

* Adds Relation tests

* remove flaky tests

* use promises instead of CB

* disable flaky test

* nits

* Fixes on schema spec

- Next thing is to implemenet geopoint and files correctly

* fix failues

* Basic GeoPoint support

* Adds support for $nearSphere/$maxDistance geopoint queries

* enable passing tests

* drop tables afterEach for PG, clean up relation tables too

* Better initialization/dropTables
2016-08-15 16:48:39 -04:00
Drew
ae36200d1f Disable tests that don't work in Postgres, and don't start a mongo for postgres tests (#2481)
* Disable tests that don't work in Postgres, and don't start a mongo for postgres tests

* Remove unnecessary chages

* remove more unnecessary chagnes
2016-08-07 22:21:01 -04:00
sud
e4c2e65263 Non trivial before save pointer clobber (#2406)
* test case to check beforeSave changes clobbers fetched pointer fields
Basically if beforeSave makes any changes to the object it is trying to save, the fetched pointer fields on the client gets clobbered to only pointer.

* propogate only changed fields to response.
Earlier we were returning all fields even if any changes happened in beforeSave. This causes the fetched pointer fields on the client to get clobbered to only pointers.
This fix returns only the changed fields thus avoiding pointer clobber.

* The goal of this comparision seems to be checking that the all returns the user correctly.
Also it is consistent with the hosted parse that user.username not returned from PUT request.
2016-08-05 08:53:54 -04:00
Florent Vilmart
c9fc80984a Makes sure we don't strip authData or session token from users using masterKey (#2348)
* Makes sure we don't strip auth data or session token from users queried with masterKey (#2342))

* nit: test title
2016-07-23 11:14:53 -07:00
Dan Huang
c81f48aae6 don't serve null authData values (#2320) 2016-07-18 23:00:16 -07:00
Florent Vilmart
025482ea1a Fix null relation problem (#2319)
* Add null check for relation type map.

For relations that are not explicitly defined in the schema, we need a null check here.

* Making change to force rebuild.

* Reverting change.

* Adds test
2016-07-18 22:58:37 -07:00
Florent Vilmart
32f7230aca Creates a new sessionToken when updating password (#2266)
* Creates a new sessionToken when updating password

* Adds test ensuring email is properly sent when upgrading from anon
2016-07-13 07:18:24 -04:00
Florent Vilmart
61aa5a8d62 Let auth data be updated on login (#2219)
* Let user update authData token upon login

* Adds tests that ensures linked authData isnt overriden

* fixes focused testing problem
2016-07-08 21:49:46 -07:00
Florent Vilmart
147b493e23 Results invalid session when providing an invalid session token (#2154)
* Results invalid session when providing an invalid session token

* Reverts unsafe loggers

* Fixes failing tests

- The tests were failin when run in sequence as we called done() before the JSSDK had a chance to register the session token, therefore having a proper logout call in afterEach
2016-06-26 23:20:02 -04:00
Drew
ab06055369 Postgres exclude failing tests (#2081)
* reload the right data

More passing postgres tests

Handle schema updates, and $in for non array columns

remove authdata from user and implement ensureUniqueness

Make some tests work, detect existing classes

Throw proper error for unique index violation

fix findOneAndUpdate

Support more types

support more type

Support boolean, fix _rperm/_wperm, add TODO

Support string types and also simplify tests

Move operator flattening into Parse Server and out of mongo adapters

Move authdata transform for create into Parse Server

Move authdata transforms completely in to Parse Server

Fix test setup

inline addSchema

Inject default schema to response from DB adapter

* Mark tests that don't work in Postgres

* Exclude one more test

* Exclude some more failing tests

* Exclude more tests
2016-06-17 12:59:16 -04:00
Drew Gross
a69a88f3a4 Fix some stuff 2016-06-15 13:11:51 -07:00
Drew Gross
f75c8b3a4d index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"
reconfigure username/email tests

Fix broken cloud code

Save callback to variable

undo

Fix all tests where connections are left open after server closes.

Fix issues caused by missing gridstore adapter

remove uses of _collection

reorder find() arguments

Accept a database adapter as a parameter

sudo maybe?

use postgres username

reorder find() arguments

Build objects with default fields correctly

Don't tell adapter about ACL

WIP
2016-06-15 13:11:51 -07:00
Drew
7e868b2dcc Unique indexes (#1971)
* Add unique indexing

* Add unique indexing for username/email

* WIP

* Finish unique indexes

* Notes on how to upgrade to 2.3.0 safely

* index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"

* reconfigure username/email tests

* Start dealing with test shittyness

* Remove tests for files that we are removing

* most tests passing

* fix failing test

* Make specific server config for tests async

* Fix more tests

* fix more tests

* Fix another test

* fix more tests

* Fix email validation

* move some stuff around

* Destroy server to ensure all connections are gone

* Fix broken cloud code

* Save callback to variable

* no need to delete non existant cloud

* undo

* Fix all tests where connections are left open after server closes.

* Fix issues caused by missing gridstore adapter

* Update guide for 2.3.0 and fix final tests

* use strict

* don't use features that won't work in node 4

* Fix syntax error

* Fix typos

* Add duplicate finding command

* Update 2.3.0.md
2016-06-10 20:27:21 -07:00
Drew
b2183680be Refactor cloud code tests (#1837)
* Move cloud code tests

* Remove _removeHook calls that are no longer necessary

* Use Strict
2016-05-19 13:38:16 -07:00
Marco Cheung
d0c3535a39 Fix error when unset user email (#1778) 2016-05-13 10:51:01 -07:00
Drew
d33dd68cc5 Add revokeSessionOnPasswordReset option. Closes #1584 (#1597)
* Add revokeSessionOnPasswordReset option

* Fix nits
2016-04-22 18:21:50 -04:00
Drew
7b91ee98ed Fixes #1568 (#1574) 2016-04-20 18:42:18 -04:00
Florent Vilmart
59b4047de8 Defers the session creation after DB operation (#1561) 2016-04-20 11:57:38 -04:00
Drew
5d37755d88 Test facebook unlinking (regression test #1532) (#1538) 2016-04-20 00:31:15 -07:00
Florent Vilmart
73a3db44ab Fixes #1444 (#1451) 2016-04-11 11:27:55 -07:00
Florent Vilmart
b433fb9b4e Prevents _User lock out when setting ACL on signup or afterwards (#1429) 2016-04-08 13:19:41 -04:00
Jeremy May
f99b5588ab Added session length option for session tokens to server configuration 2016-04-02 11:36:47 -04:00
yuzeh
1b8e613dfb Clean authData of null values on _User update
Adds a step to the RestWrite#execute chain: it cleans the response
authData object of null values.

For example, this:

{"authData": {"anonymous": null}, "updatedAt", ...}

will be transformed to this:

{"updatedAt", ...}

And this:

{"authData": {"anonymous": null, "twitter": ...}, "updatedAt", ...}

will be transformed to this:

{"authData": {"twitter": ...}, "updatedAt", ...}

Fixing this issue will fix anonymous user upgrades from the Android SDK.
2016-03-29 14:42:37 -07:00
Florent Vilmart
a31baa4ebd differentiate signup and login createdWith.action on _Session 2016-03-20 15:58:17 -04:00
Fosco Marotto
877d29daf8 Clear the session-user cache when changing _User objects 2016-03-17 02:06:26 -07:00
Florent Vilmart
461ddcbd05 Makes sure the location in results has the proper objectId 2016-03-16 20:37:59 -04:00
Florent Vilmart
cadd6fe406 Sanitizes RestWrite.data before passing to inflated object 2016-03-11 23:03:47 -05:00
Florent Vilmart
7d787328c5 Merge pull request #952 from ParsePlatform/flovilmart.OAuthImprovements
AuthData logic refactor
2016-03-11 15:38:19 -05:00