Commit Graph

84 Commits

Author SHA1 Message Date
Miroslav Bajtoš 845c59eced test/user: use local registry
Rework User tests to not depend on `app.autoAttach()` and global shared
registry of Models. Instead, each tests creates a fresh app instance
with a new in-memory datasource and a new set of Models.
2016-05-03 14:39:06 +02:00
Ryan Graham a0806eab89 test: remove errant console.log from test
Using console.log like this can result in invalid xml when the xunit
reporter is used.

[Backport of pull request #2035]
2016-02-05 09:22:43 +01:00
Miroslav Bajtoš a0a1083564 Hide verificationToken
We should never be showing this publically.

Adds unit test for hiding verification token.

This is a back-port of pull request #1851 from gausie/patch-4
2016-02-04 16:27:03 +01:00
Richard Pringle 2cca83c4ff Add case-sensitve email option for User model. 2015-12-03 13:18:49 -05:00
Simo Moujami 403e677155 Fix user.resetPassword to fail on email not found 2015-11-02 12:55:24 +01:00
Samuel Gaus 351b8026a0 Do not include redundant ports in verify links
If the protocol and port match we can ignore the port for a more
visually appealing link.
2015-10-12 16:24:30 +02:00
Pradnya Baviskar dc987a59a9 Promisify User model 2015-07-14 13:01:46 +05:30
Raymond Feng 12e19e36ea Upgrade test fixtures to use LB 2.x layout 2015-04-20 09:23:44 -07:00
Miroslav Bajtoš 699bc7aa97 test: remove global autoAttach 2015-04-07 15:25:18 +02:00
jakerella 713001913e Ability to pass in custom verification token generator
This commit adds the ability for the developer to use a custom token generator function for the user.verify(...) method. By default, the system will still use the crypto.randomBytes() method if no option is provided.
2015-03-19 16:56:38 -04:00
Raymond Feng 78550a9bc5 Pass options from User.login to createAccessToken
It will allow subclass of User to create access token based on additional
properties such as 'scope'.
2015-03-02 14:48:08 -08:00
Miroslav Bajtoš 3c43eccac7 Merge pull request #1120 from PradnyaBaviskar/lb-issue-416
Fix "User.confirm" to always call afterRemote hook

Close #1120
2015-02-25 14:26:07 +01:00
Pradnya Baviskar 8766d4a68d Fix "User.confirm" to always call afterRemote hook
Make the "redirect" parameter optional. When the parameter is not
specified, the server responds with an empty response (204). This allows
API clients to call the method without the need to handle redirects
and HTML responses.

Even when the "redirect" parameter is included, the builtin afterRemote
hook still calls next(), so that user-provided afterRemote hooks
are executed too.
2015-02-25 14:20:47 +01:00
Raymond Feng 13e618bff2 Skip hashing password if it's already hashed
See https://github.com/strongloop/loopback-datasource-juggler/issues/471
2015-02-24 16:36:51 -08:00
Miroslav Bajtoš c2236c393b Upgrade jscs to ~1.11 via grunt-jscs ^1.5 2015-02-20 15:31:15 +01:00
Raymond Feng a18fa176a8 Fix the test case 2015-01-30 08:52:45 -08:00
Ron Edgecomb a028d9d198 Add error code property to known error responses.
Enhance the error objects with a `code` property containing
a machine-readable string code describing the error, for example
INVALID_TOKEN or USER_NOT_FOUND.

Also improve 404 error messages to include the model name.
2015-01-21 19:04:47 +01:00
Raymond Feng f5eac871fd Merge branch 'master' of https://github.com/greaterweb/loopback into greaterweb-master 2015-01-07 16:35:00 -08:00
Raymond Feng 90fd62ec0a Merge pull request #941 from strongloop/feature/workaround-issue-251
Allow User.hashPassword/validatePassword to be overridden
2015-01-07 14:01:03 -08:00
Raymond Feng b7db9808b2 Allow User.hashPassword/validatePassword to be overridden
See https://github.com/strongloop/loopback/issues/251
2015-01-06 16:03:30 -08:00
Ron Edgecomb 62bb63b4f2 Additional password reset unit tests for API and REST
- strongloop/loopback#944
2015-01-06 10:31:53 -05:00
Ron Edgecomb 9ac620c113 Small formatting update to have consistency with identical logic in other areas.
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb 36112d2b50 Simplify the API test for invalidCredentials (removed create), move above REST calls for better grouping of tests
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb e4a1baa4a3 Force request to send body as string, this ensures headers aren't automatically set to application/json
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb 572a8bb423 Ensure error checking logic is in place for all REST calls, expand formatting for consistency with existing instances.
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb 6de1da5d22 Correct invalidCredentials so that it differs from validCredentialsEmailVerified, unit test now passes as desired.
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb 3b4cadf7a3 Update to demonstrate unit test is actually failing due to incorrect values of invalidCredentials
- strongloop/loopback#944
2015-01-06 10:31:52 -05:00
Ron Edgecomb 70f576b452 API and REST tests added to ensure complete and valid credentials are supplied for verified error message to be returned
- tests added as suggested and fail under previous version of User model
 - strongloop/loopback#931
2015-01-05 18:40:59 -05:00
Clark Wang 2f9400fc87 fix User.settings.ttl can't be overridden in sub model
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-12-28 16:02:37 +08:00
Rob Halff 36e1f6840c fix jscs errors 2014-11-21 03:35:36 +01:00
Rob Halff 918497c365 singlequote, semicolon & /*jshint -W030 */ 2014-11-21 02:46:21 +01:00
Miroslav Bajtoš fec8234c4c Merge pull request #616 from jpizarrom/master
added email custom headers in user verify
2014-10-24 19:51:10 +02:00
Juan Pizarro 4098bec2c6 User: custom email headers in verify 2014-10-24 14:42:49 -03:00
Raymond Feng b98ada282f Merge pull request #660 from strongloop/feature/add-realm-support
Add realm support
2014-10-24 08:27:28 -07:00
Raymond Feng 46d1430023 Add realm support 2014-10-23 11:10:39 -07:00
Miroslav Bajtoš b57cd3e409 User: fix `confirm` permissions
Enable authentication for all User unit-tests to check that the ACLs are
correctly configured.

Fix the rule for `confirm` - the correct permission is `ALLOW`, not
`ACL.ALLOW`.
2014-10-23 13:19:43 +02:00
Miroslav Bajtoš b1e0edb22b test: verify exported models 2014-10-14 08:58:17 +02:00
Alexander Ryzhikov 58538f02b7 user#login include server crash fix
Signed-off-by: Alexander Ryzhikov <coobaha@gmail.com>
2014-09-03 09:58:49 +04:00
Raymond Feng 567e2530d7 Build the email verification url from app context
https://github.com/strongloop/loopback/issues/408
2014-07-26 22:39:42 -07:00
Raymond Feng 335bae4b46 Merge branch 'master' into feature/fix-issue-377 2014-07-22 10:49:20 -07:00
Raymond Feng 21b8609ee2 Report error for User.confirm()
See https://github.com/strongloop/loopback/issues/377
2014-07-22 10:42:22 -07:00
Raymond Feng 74e9ff75e3 Merge pull request #385 from offlinehacker/master
Validate username uniqueness
2014-07-21 15:26:01 -07:00
Jaka Hudoklin 90094e5e86 Validate username uniqueness
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-19 14:18:21 +02:00
Raymond Feng e5b64c6143 Upgrade to nodemailer 1.0.1 2014-07-16 12:40:15 -07:00
Raymond Feng 7b36196561 Merge pull request #362 from strongloop/feature/remoting-add-remove
Add a test case for hasMany through add/remove remoting
2014-07-15 16:15:27 -07:00
Raymond Feng 54b13f4feb Upgrade to loopback-datasource-juggler@1.7.0 2014-07-15 16:15:02 -07:00
Raymond Feng 76b6dc10d9 Add a test case for credentials/challenges 2014-07-15 08:20:47 -07:00
Raymond Feng 74a39f3fc2 Refactor email verification tests into a new group 2014-07-08 08:54:50 -07:00
Raymond Feng 0c67b1e781 Add an option to honor emailVerified
See https://github.com/strongloop/loopback/pull/215
2014-07-07 14:09:45 -07:00
Raymond Feng 6b4ebdf609 Allow the creation of access token to be overriden 2014-06-09 14:53:55 -07:00