Skip to content

Commit

Permalink
New user auth flow (#31)
Browse files Browse the repository at this point in the history
* Create basic endpoint skeleton

* get endpoint 500 error

* Fix routing

* Get member endpoint to work

* Return more fields from endpoint

* Return object id from endpoint

* Add filterSensitiveInfo util

* Give all non-required Member fields a default of null

* Move passport-setup to utils

* Remove console.log

* Add members endpoints

* Fix filterSensitiveInfo util

* Use passport-setup.js in utils

* Use auth endpoint

* Move /api/auth/user to /api/members/current

* Add omit fields to GET /:memberId

* Change current user endpoint in frontend

* Add more auth utils

* Use isDirector from module in members routes

* Change level default in model back to TBD

* Add level priority explanation

* Add detailed permission checking in members endpoint

* Fix difference function

* Fix typos in user-utils

* Add _id as neverEditable field

* Fix allFields not being checked correctly

* Filter viewable fields when returning from PUT

* Pull enum options from backend

* Add status options to endpoint

* Disable dropdowns

* Add labels to fields

* Create wrapper for getting member by ID

* Add boolean selector

* Add number fields

* Add fields for basic string attributes

* Retrieve schema type from DB

* Move preprocessing to backend

* Fix enum type detection

* Remove duplicated code

* Fix attribute change error

* Run formatter

* Remove warnings

* Format client

* Populate edit fields from DB

* Add types to props

* Run formatter

* Remove alert

* Run formatter

* Get permissions from backend

* Disable input boxes if missing permissions

* Add enum dropdowns

* Format client

* Remove user ID override

* Change to ES6 defaults

* Remove unused package

* Change var to let

* Concisen member options endpoint

* Delete env file

* Unexport schema

* Use concise property iteration

* Make /options endpoint concise

* Remove unneeded exports

* Capitalize constant

* Shorten attribute change callback

* Run formatter

* Turn off default-props in linter

* Fix var name typo

* Change member page routing

* Run formatter

* Use useParams hook

* Change object syntax

* Run formatter

* Start creating tool to transfer data

* Consolidate envs and clean up app.js

* Fix yarn test not using .env

* Add lint-staged pre-commit hook (#27)

* Add lint-staged pre-commit hook

* Format "unstaged" files

* Sync prettier versions

* Format all files using new Prettier config

* Finish writing tool

* Format remaining fields

* Check for member uniqueness

* Fix enum formatting

* Run formatter

* Run formatter

* Run format with new hook

* Change new sign-in process to attempt to link user via email

* Show login error on frontend

* Remove unused Member page (renamed)

* Fix navbar welcome text spacing

* Fix lint

* Switch to cookie-session

* Make login failure text constant

* Make login failure query param constant

Co-authored-by: mlw6 <[email protected]>
Co-authored-by: ishaansharma <[email protected]>
Co-authored-by: Yousef Ahmed <[email protected]>
  • Loading branch information
4 people authored and n3a9 committed May 23, 2021
1 parent 620581e commit c886982
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions client/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import '../css/Login.css';
import { FRONTEND_BASE_URL } from '../utils/apiUrls';
import buildURI from '../utils/apiHelpers';

const LOGIN_FAILURE_QUERY_PARAM = 'failure';
const LOGIN_FAILURE_TEXT =
'First time logging in? Your email isn&apos;t verified. Please contact an admin.';

// A custom hook that builds on useLocation to parse
// the query string for you.
function useQuery() {
Expand All @@ -17,7 +21,7 @@ function useQuery() {
* Displays the login page over everything else
*/
const Login = () => {
const didLoginFail = useQuery().get('failure');
const didLoginFail = useQuery().get(LOGIN_FAILURE_QUERY_PARAM);

return (
<div className="login-wrapper">
Expand All @@ -26,16 +30,15 @@ const Login = () => {
{didLoginFail && (
<Alert variant="error" mb="8px">
<Icon type="errorAlert" />
First time logging in? Your email isn&apos;t verified. Please
contact an admin.
{LOGIN_FAILURE_TEXT}
</Alert>
)}
<a
type="button"
href={buildURI(
'auth/login',
FRONTEND_BASE_URL,
`${FRONTEND_BASE_URL}/login?failure=1`,
`${FRONTEND_BASE_URL}/login?${LOGIN_FAILURE_QUERY_PARAM}=1`,
)}
className="login-btn"
>
Expand Down

0 comments on commit c886982

Please sign in to comment.