Skip to content

Commit

Permalink
Merge pull request #139 from fac-14/authentication
Browse files Browse the repository at this point in the history
routes now restricted, but not with jwt > #123
  • Loading branch information
SleepySheepy172 authored Nov 29, 2018
2 parents faa1564 + ea39212 commit 85cd6ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ class App extends Component {
<Route
exact={true}
path="/profile/:id/add"
render={props => <Add {...props} />}
render={props => {
return isAuthenticated ? (
<Add {...props} />
) : (
<Redirect
to={{ pathname: "/login", state: { from: props.location } }}
/>
);
}}
/>
<Route exact={true} path="/find" component={Discovery} />
<Route exact={true} path="/login" component={LogIn} />
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/LogIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class LogIn extends React.Component {
allowFetchSubmit: false
};

/*
/*
Possible functions:
sanitiseInputs() // to remove any "illegal" characters from email and pw inputs
handleBackendValidation // likely not necessary and implemented as part of the fetch
Expand Down Expand Up @@ -112,6 +112,8 @@ export default class LogIn extends React.Component {
type="email"
onBlur={this.checkEmailValid}
required
autocomplete="on"
x-autocompletetype="email"
/>
<label htmlFor="password">
<h3>Password</h3>
Expand Down

0 comments on commit 85cd6ea

Please sign in to comment.