diff --git a/README.md b/README.md index 1d02e11..b573d97 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ The test suite is run using `npm test` and `npm run test:watch`. Individual unit // auth can't be null to make/edit post // if the post exists, auth.uid must match creatorUID ".write": "(auth != null && !data.exists()) || data.child('creatorUID').val() === auth.uid", - + // make sure all 5 fields are present before saving a new post // leave 'isDeleted' when deleting a post ".validate": "newData.hasChildren(['title', 'url', 'creator', 'creatorUID', 'time']) || @@ -124,12 +124,12 @@ The test suite is run using `npm test` and `npm run test:watch`. Individual unit "comments": { ".read": true, ".indexOn": ["postId","creatorUID","time"], - + "$comment_id": { ".write": "auth != null && (!data.exists() || data.child('creatorUID').val() === auth.uid)", ".validate": "newData.hasChildren(['postId', 'text', 'creator', 'creatorUID', 'time']) && (newData.child('text').isString() && newData.child('text').val() != '')", - + "upvotes": { // upvotes must be writable by anyone logged in ".write": "auth != null", @@ -169,4 +169,12 @@ The test suite is run using `npm test` and `npm run test:watch`. Individual unit } } -``` \ No newline at end of file +``` + +## Firebase Authentication + +To set up users, from your Firebase dashboard: + +1. Click Auth +1. Click users +1. Enable Email/password sign-in method diff --git a/src/js/util/constants.js b/src/js/util/constants.js index 51d6261..31acf8b 100644 --- a/src/js/util/constants.js +++ b/src/js/util/constants.js @@ -10,6 +10,7 @@ export const errorMessages = { NO_USERNAME: 'You have to enter a username.', EMAIL_TAKEN: 'That email is taken.', USERNAME_TAKEN: 'That username is taken.', + AUTHENTICATION_DISABLED: 'Your administrator needs to configure Firebase authentication', generic: 'Something went wrong.' };