-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPII-3921: Update gpii-express-user to use modern dependencies, especially gpii-json-schema. #6
Changes from 12 commits
8702af2
015bb40
6efdc50
403e8ae
fe3f137
836e94c
4c21f06
de1da4c
729acf2
154a17f
150969f
226da8d
af9ef80
d3d84c3
5356bca
66644e8
8c336b3
6e9141d
e82f440
7ec477d
5e9b6c2
55a7a35
34478ed
69e5640
bc104fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"extends": "eslint-config-fluid" | ||
"extends": "eslint-config-fluid" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"reporter": ["none"], | ||
"report-dir": "reports", | ||
"temp-dir": "coverage", | ||
"clean": false, | ||
"exclude": ["**/tests/**/*.js"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ Returns details about the current user if they are logged in, as in: | |
|
||
```json | ||
{ | ||
"ok": true, | ||
"user": { | ||
"username": "sample", | ||
"email": "[email protected]" | ||
|
@@ -28,13 +27,11 @@ Returns an error message if the user is not currently logged in, as in: | |
|
||
```json | ||
{ | ||
"ok": false, | ||
"isError": true, | ||
"message": "You are not currently logged in." | ||
} | ||
``` | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `POST /api/user/login` | ||
|
||
Log a user in. Requires both a `username` and `password`, as in: | ||
|
@@ -46,19 +43,14 @@ Log a user in. Requires both a `username` and `password`, as in: | |
} | ||
``` | ||
|
||
[Request schema](../schemas/user-login.json) | ||
|
||
Returns a confirmation message indicating whether the login was successful, as in: | ||
|
||
```json | ||
{ | ||
"ok": true, | ||
"message": "You are now logged in." | ||
} | ||
``` | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
Note that only users with verified email addresses are allowed to log in. For details, see `GET /api/user/verify/:code` | ||
below. | ||
|
||
|
@@ -68,13 +60,10 @@ Immediately logs the current user out and returns a confirmation message, as in: | |
|
||
```json | ||
{ | ||
"ok": true, | ||
"message": "You are now logged out." | ||
} | ||
``` | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `POST /api/user` | ||
|
||
Create a new user. Anyone can create a user, but the account cannot be used until the email address is verified (see | ||
|
@@ -92,19 +81,15 @@ Requires a `username`, valid `password`, and a `confirm` field with the same pas | |
} | ||
``` | ||
|
||
[Request schema](../schemas/user-signup.json) | ||
|
||
Returns a confirmation message indicating whether the response was successful, as in: | ||
|
||
```json | ||
{ | ||
"ok": false, | ||
"isError": true, | ||
"message": "A user with this email address already exists." | ||
} | ||
``` | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `GET /api/user/verify/:code` | ||
|
||
When a new account is created, an email is sent to the address associated with the account. The email contains a link | ||
|
@@ -115,13 +100,10 @@ account. A successful response should look something like: | |
|
||
```json | ||
{ | ||
"ok": true, | ||
"message": "Your email address has been verified and you can now use your account to log in." | ||
} | ||
``` | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `POST /api/user/verify/resend/:email` | ||
|
||
If a user loses their initial verification email, they can ask for it to be sent again by supplying the `email` address | ||
|
@@ -135,20 +117,14 @@ they used when signing up, as in: | |
|
||
Returns a confirmation message indicating whether the response was successful. | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `GET /api/user/forgot/:email` | ||
|
||
Users can request a link that can be used to reset their password. This is a three step process. The first step | ||
(handled by this endpoint) sends a message to the supplied `email` address. For the second step, see `GET | ||
/api/user/reset/:code` below. | ||
|
||
[Request schema](../schemas/user-forgot.json) | ||
|
||
Returns a confirmation message indicating whether the response was successful. | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `GET /api/user/reset/:code` | ||
|
||
If a user has requested that their password be reset using the `GET /api/user/forgot/:email` API endpoint (see above), | ||
|
@@ -157,8 +133,6 @@ they will receive an email message that contains a link to this endpoint. | |
By visiting this link, they are presented with a form that will allow them update their password using the `POST | ||
/api/user/reset/:code` endpoint (see below) | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
### `POST /api/user/reset/:code` | ||
|
||
Allows a user to reset their password using a `code` received via email (see `GET /api/user/forgot/:email`). The user | ||
|
@@ -171,12 +145,8 @@ is required to enter a valid `password` and to enter the same password in a `con | |
} | ||
``` | ||
|
||
[Request schema](../schemas/user-reset.json) | ||
|
||
Returns a confirmation of whether the response was successful. | ||
|
||
[Response schema](../schemas/user-message.json) | ||
|
||
## /api/group | ||
|
||
The following endpoints are used to manage groups. All parts of the group API require the user to be an administrator. | ||
|
@@ -185,8 +155,6 @@ The following endpoints are used to manage groups. All parts of the group API r | |
|
||
Displays the group metadata as well as the `username` of all members of `:group`. | ||
|
||
[Response schema](../schemas/group-message.json) | ||
|
||
### `POST /api/group/:group` | ||
|
||
Create a new group named `:group`. A group is required to have a valid (URL-safe) `name`, and may optionally include a | ||
|
@@ -199,18 +167,12 @@ list of `members`, each of which is expected to be valid `username`, as in: | |
} | ||
``` | ||
|
||
[Request schema](../schemas/group-core.json) | ||
|
||
Returns a confirmation of whether the response was successful. | ||
|
||
[Response schema](../schemas/group-message.json) | ||
|
||
### `DELETE /api/group/:group` | ||
|
||
Delete the group named `:group`. Returns a confirmation of whether the response was successful. | ||
|
||
[Response schema](../schemas/group-message.json) | ||
|
||
## /api/memberships | ||
|
||
The following endpoints are used to manage the membership of users in one or more groups. An individual user can only | ||
|
@@ -221,17 +183,11 @@ view their own memberships, using `GET /api/memberships/:username` (see below). | |
Displays a list of group memberships for the given `:username`. If `:username` is omitted, the memberships for the | ||
current user are displayed. For a list of users in a single group, see `GET /api/group/:group` above. | ||
|
||
[Response schema](../schemas/memberships-message.json) | ||
|
||
### `POST /api/memberships/:username/:group` | ||
|
||
Add `:username` to `:group`. Does not expect and will ignore any JSON data you send. Returns a confirmation of whether | ||
the response was successful. | ||
|
||
[Response schema](../schemas/message-core.json) | ||
|
||
### `DELETE /api/memberships/:username/:group` | ||
|
||
Remove `:username` from `:group`. Returns a confirmation of whether the response was successful. | ||
|
||
[Response schema](../schemas/message-core.json) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,13 @@ | |
"name": "gpii-express-user", | ||
"version": "1.0.2", | ||
"description": "A series of Fluid components to provide simple user management.", | ||
"main": "src/js/index.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node node_modules/istanbul/lib/cli.js cover tests/all-tests.js" | ||
"pretest": "node node_modules/rimraf/bin.js coverage/* reports/* instrumented/*", | ||
"test": "npm run test:webdriver && npm run test:node", | ||
"test:webdriver": "node tests/js/browser/index.js", | ||
"test:node": "node node_modules/nyc/bin/nyc.js node tests/js/server/index.js", | ||
"posttest": "node node_modules/nyc/bin/nyc.js report --reporter html --reporter text-summary" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -18,30 +22,31 @@ | |
"homepage": "https://github.com/GPII/gpii-express-user", | ||
"dependencies": { | ||
"foundation-sites": "6.3.1", | ||
"gpii-binder": "1.0.3", | ||
"gpii-express": "1.0.14", | ||
"gpii-handlebars": "1.1.0", | ||
"gpii-json-schema": "1.0.5", | ||
"infusion": "3.0.0-dev.20180326T173646Z.8c6a109b1", | ||
"kettle": "1.7.3", | ||
"markdown-it": "8.4.1", | ||
"nodemailer": "4.6.7", | ||
"gpii-binder": "1.0.5", | ||
"gpii-express": "1.0.15", | ||
"gpii-handlebars": "2.1.0-dev.20191014T141924Z.45a74ef.GPII-4100", | ||
"gpii-json-schema": "2.1.2-dev.20191014T143306Z.8a372f7.GPII-4022", | ||
"infusion": "3.0.0-dev.20191009T141140Z.32c9263b4.FLUID-6148", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please try for 3.0.0-dev.20200317T122331Z.1aa7ea8a1.FLUID-6145 if possible There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This catastrophically breaks things with complaints about circular references. I will have to give it a go tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Looking at the grade in question, I don't see how this is circular. It's the express strategy we've discussed for (re)using JSON schema-like "definitions" using IoC instead of their There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, this is a helpful report, if a very unwelcome one - it looks like FLUID-6145 contains an additional "retrunking" bug of the kind tracked in https://issues.fluidproject.org/browse/FLUID-4930 . I had encountered this in my own work and written a failing test case that looks so amb26/infusion@FLUID-6145...amb26:FLUID-4930#diff-ab93103a69113cb998d7630a3c4f4451R506 - I thought I could dodge fixing it but given you have what looks like a pretty vanilla triggering of it there seems to be little alternative but to write it up and fix it. I had thought that the use of an expander was essential to triggering the bug but it seems not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diff link doesn't show me anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the markdown renderer has stuffed up the anchor - here it is without: amb26/infusion@FLUID-6145...amb26:FLUID-4930 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amb26, I see the circular dependency detection issues when running the tests locally using either FLUID-6145 or FLUID-6148. The tests in gpii-json-schema itself work fine with FLUID-6148, I suspect that's because I don't have tests for complex reuse of material via IoC in that package (I'll add some). Is there a branch that includes the fixes for FLUID-6503 but which does not include the circular dependency checks tripping this up (or that includes a fix)? I need to be able to reliably remix schema material like this using IoC in the LSR era, so any help you can provide would be helpful. |
||
"kettle": "1.11.0", | ||
"markdown-it": "10.0.0", | ||
"nodemailer": "6.3.0", | ||
"nodemailer-smtp-transport": "2.7.4", | ||
"request": "2.87.0" | ||
"request": "2.88.0" | ||
}, | ||
"devDependencies": { | ||
"cookie": "0.3.1", | ||
"eslint": "5.1.0", | ||
"cookie": "0.4.0", | ||
"eslint-config-fluid": "1.3.0", | ||
"gpii-grunt-lint-all": "1.0.1-dev.20180706T153657Z.4cbbd61", | ||
"gpii-mail-test": "1.0.3", | ||
"gpii-pouchdb": "1.0.12", | ||
"gpii-webdriver": "1.0.2", | ||
"grunt": "1.0.3", | ||
"handlebars": "4.0.11", | ||
"istanbul": "0.4.5", | ||
"mailparser": "0.6.2", | ||
"eslint": "6.5.0", | ||
"gpii-couchdb-test-harness": "1.0.0-dev.20190627T080736Z.0e3a1fd.GPII-3531", | ||
"gpii-grunt-lint-all": "1.0.5", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Latest version is now 1.0.7 of gpii-grunt-lint-all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, done. |
||
"gpii-mail-test": "1.0.5", | ||
"gpii-webdriver": "1.1.0", | ||
"grunt": "1.0.4", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few of these have become further outdated since this pull was issued, e.g. grunt -> 1.1.0, eslint -> 6.8.0 (doesn't lint-all pull in its own deps anyway?) |
||
"handlebars": "4.4.0", | ||
"mailparser": "2.7.1", | ||
"node-jqunit": "1.1.8", | ||
"pagedown": "1.1.0" | ||
"nyc": "14.1.1", | ||
"pagedown": "1.1.0", | ||
"rimraf": "3.0.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(function (fluid) { | ||
"use strict"; | ||
fluid.defaults("gpii.express.user.frontend.errorAwareForm", { | ||
gradeNames: ["gpii.schema.client.errorAwareForm"], | ||
resources: { | ||
modelSchema: { | ||
promiseFunc: "{schemaHolder}.generateSchema" | ||
} | ||
}, | ||
modelSchema: "{that}.model.modelSchema", | ||
model: { | ||
modelSchema: "{that}.resources.modelSchema.parsed" | ||
}, | ||
components: { | ||
schemaHolder: { | ||
type: "gpii.express.user.schemaHolder" | ||
} | ||
} | ||
}); | ||
})(fluid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foundation-sites 6.6.3 is available if suitable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Their .1 releases have often required more energy than I can muster. I will give it a try and see how it looks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.