-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from the-t-in-rtf/GPII-3921
GPII-3921: Update gpii-express-user to use modern dependencies, especially gpii-json-schema.
- Loading branch information
Showing
68 changed files
with
697 additions
and
842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.