-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from basic auth to form based login (#562)
* Restore login related files (with some tweaks) from 9afc03b * Add eslint and editorconfig for linting and consistency * Clean up the login page and unused scss * Update server to respond to use passport users and server /login * Implement form based login with passport, passport-local, and cookie-session * Add log out button to footer * Disable CSRFInput for now as it isn't properly implemented * Remove unused basic-auth module * Revert "Add eslint and editorconfig for linting and consistency" This reverts commit 008092b. * Add two more test cases for Authentication.authenticate * Code clean up * Add proper CSRF handling to login through express and existing React components
- Loading branch information
1 parent
c49b057
commit be9f498
Showing
16 changed files
with
444 additions
and
40 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
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,65 @@ | ||
/* | ||
* Copyright (c) 2016-present, Parse, LLC | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the LICENSE file in | ||
* the root directory of this source tree. | ||
*/ | ||
import LoginForm from 'components/LoginForm/LoginForm.react'; | ||
import LoginRow from 'components/LoginRow/LoginRow.react'; | ||
import React from 'react'; | ||
|
||
export const component = LoginForm; | ||
|
||
export const demos = [ | ||
{ | ||
render() { | ||
return ( | ||
<div style={{ background: '#06283D', height: 500, position: 'relative' }}> | ||
<LoginForm | ||
header='Access your Dashboard' | ||
footer={<a href='javascript:;'>Forgot something?</a>} | ||
action='Log In'> | ||
<LoginRow | ||
label='Email' | ||
input={<input type='email' />} /> | ||
<LoginRow | ||
label='Password' | ||
input={<input type='password' />} /> | ||
</LoginForm> | ||
</div> | ||
); | ||
} | ||
}, { | ||
render() { | ||
return ( | ||
<div style={{ background: '#06283D', height: 700, position: 'relative' }}> | ||
<LoginForm | ||
header='Sign up with Parse' | ||
footer={ | ||
<div> | ||
<span>Signing up signifies that you have read and agree to the </span> | ||
<a href='https://parse.com/about/terms'>Terms of Service</a> | ||
<span> and </span> | ||
<a href='https://parse.com/about/privacy'>Privacy Policy</a>. | ||
</div> | ||
} | ||
action='Sign Up'> | ||
<LoginRow | ||
label='Email' | ||
input={<input type='email' placeholder='email@domain' autoComplete='off' />} /> | ||
<LoginRow | ||
label='Password' | ||
input={<input type='password' placeholder='The stronger, the better' autoComplete='off' />} /> | ||
<LoginRow | ||
label='App Name' | ||
input={<input type='text' placeholder='Name your first app' />} /> | ||
<LoginRow | ||
label='Company' | ||
input={<input type='text' placeholder='(Optional)' />} /> | ||
</LoginForm> | ||
</div> | ||
); | ||
} | ||
} | ||
]; |
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,45 @@ | ||
/* | ||
* Copyright (c) 2016-present, Parse, LLC | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the LICENSE file in | ||
* the root directory of this source tree. | ||
*/ | ||
import CSRFInput from 'components/CSRFInput/CSRFInput.react'; | ||
import Icon from 'components/Icon/Icon.react'; | ||
import PropTypes from 'lib/PropTypes'; | ||
import React from 'react'; | ||
import styles from 'components/LoginForm/LoginForm.scss'; | ||
import { verticalCenter } from 'stylesheets/base.scss'; | ||
|
||
// Class-style component, because we need refs | ||
export default class LoginForm extends React.Component { | ||
render() { | ||
return ( | ||
<div className={styles.login} style={{ marginTop: this.props.marginTop || '-220px' }}> | ||
<Icon width={80} height={80} name='infinity' fill='#093A59' /> | ||
<form method='post' ref='form' action={this.props.endpoint} className={styles.form}> | ||
<CSRFInput /> | ||
<div className={styles.header}>{this.props.header}</div> | ||
{this.props.children} | ||
<div className={styles.footer}> | ||
<div className={verticalCenter} style={{ width: '100%' }}> | ||
{this.props.footer} | ||
</div> | ||
</div> | ||
<input | ||
type='submit' | ||
disabled={!!this.props.disableSubmit} | ||
onClick={() => { | ||
if (this.props.disableSubmit) { | ||
return; | ||
} | ||
this.refs.form.submit() | ||
}} | ||
className={styles.submit} | ||
value={this.props.action} /> | ||
</form> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.
be9f498
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.
@flovilmart @drew-gross
Is there anything else that needs to be done in order to make a new release off the latest
master
?Some more unit tests would be nice and I'd be happy to add some in the coming weeks. Just hoping we can get a release sooner than later.
be9f498
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.
we can release I believe :)
be9f498
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.
Needs a PR for the changelog, as well as tag :)