wip adding account pages and add seeder package
This commit is contained in:
parent
3459bf26f8
commit
ec8a7b9228
10 changed files with 150 additions and 18 deletions
33
imports/startup/server/fixtures.js
Normal file
33
imports/startup/server/fixtures.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import seeder from '@cleverbeagle/seeder';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Documents from '../../api/Documents/Documents';
|
||||
|
||||
seeder(Meteor.users, {
|
||||
environments: ['development', 'staging'],
|
||||
data: [{
|
||||
email: 'admin@admin.com',
|
||||
password: 'password',
|
||||
profile: {
|
||||
name: {
|
||||
first: 'George',
|
||||
last: 'Clooney',
|
||||
},
|
||||
},
|
||||
roles: ['admin'],
|
||||
}],
|
||||
});
|
||||
|
||||
seeder(Documents, {
|
||||
environments: ['development', 'staging'],
|
||||
wipe: true,
|
||||
min: 10,
|
||||
model(index, faker) {
|
||||
const owner = Meteor.users.findOne({ 'emails.address': 'admin@admin.com' })._id;
|
||||
const documentNumber = index + 1;
|
||||
return {
|
||||
owner,
|
||||
title: `${faker.lorem.words(5)} #${documentNumber}`,
|
||||
body: `This is the body of example document #${documentNumber}.`,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
@ -1 +1,2 @@
|
|||
import './api';
|
||||
import './fixtures';
|
||||
|
|
|
|||
16
imports/ui/components/AccountPageFooter/AccountPageFooter.js
Normal file
16
imports/ui/components/AccountPageFooter/AccountPageFooter.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import './AccountPageFooter.scss';
|
||||
|
||||
const AccountPageFooter = ({ children }) => (
|
||||
<div className="AccountPageFooter">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
AccountPageFooter.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
};
|
||||
|
||||
export default AccountPageFooter;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@import '../../stylesheets/colors';
|
||||
|
||||
.AccountPageFooter {
|
||||
margin-top: 25px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid $gray-lighter;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import { Link } from 'react-router-dom';
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import OAuthLoginButton from '../../components/OAuthLoginButton/OAuthLoginButton';
|
||||
import AccountPageFooter from '../../components/AccountPageFooter/AccountPageFooter';
|
||||
import validate from '../../../modules/validate';
|
||||
|
||||
import './Login.scss';
|
||||
|
|
@ -92,9 +93,9 @@ class Login extends React.Component {
|
|||
/>
|
||||
</FormGroup>
|
||||
<Button type="submit" bsStyle="success">Log In</Button>
|
||||
<p className="DontHaveAnAccount">
|
||||
{'Don\'t have an account?'} <Link to="/signup">Sign Up</Link>.
|
||||
</p>
|
||||
<AccountPageFooter>
|
||||
<p>{'Don\'t have an account?'} <Link to="/signup">Sign Up</Link>.</p>
|
||||
</AccountPageFooter>
|
||||
</form>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -17,11 +17,5 @@
|
|||
left: 50%;
|
||||
margin-left: -106px;
|
||||
}
|
||||
|
||||
.DontHaveAnAccount {
|
||||
margin-top: 25px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid $gray-lighter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
import React from 'react';
|
||||
import { Row, Col, Alert, FormGroup, ControlLabel, Button } from 'react-bootstrap';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import AccountPageFooter from '../../components/AccountPageFooter/AccountPageFooter';
|
||||
import validate from '../../../modules/validate';
|
||||
|
||||
class RecoverPassword extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const component = this;
|
||||
|
||||
validate(component.form, {
|
||||
rules: {
|
||||
emailAddress: {
|
||||
required: true,
|
||||
email: true,
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
emailAddress: {
|
||||
required: 'Need an email address here.',
|
||||
email: 'Is this email address correct?',
|
||||
},
|
||||
},
|
||||
submitHandler() { component.handleSubmit(); },
|
||||
});
|
||||
}
|
||||
|
||||
handleSubmit() {
|
||||
const { history } = this.props;
|
||||
const email = this.emailAddress.value;
|
||||
|
||||
Accounts.forgotPassword({ email }, (error) => {
|
||||
if (error) {
|
||||
Bert.alert(error.reason, 'danger');
|
||||
} else {
|
||||
Bert.alert(`Check ${email} for a reset link!`, 'success');
|
||||
history.push('/login');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (<div className="RecoverPassword">
|
||||
<Row>
|
||||
<Col xs={12} sm={6} md={5} lg={4}>
|
||||
<h4 className="page-header">Recover Password</h4>
|
||||
<Alert bsStyle="info">
|
||||
Enter your email address below to receive a link to reset your password.
|
||||
</Alert>
|
||||
<form ref={form => (this.form = form)} onSubmit={event => event.preventDefault()}>
|
||||
<FormGroup>
|
||||
<ControlLabel>Email Address</ControlLabel>
|
||||
<input
|
||||
type="email"
|
||||
name="emailAddress"
|
||||
ref={emailAddress => (this.emailAddress = emailAddress)}
|
||||
className="form-control"
|
||||
/>
|
||||
</FormGroup>
|
||||
<Button type="submit" bsStyle="success">Recover Password</Button>
|
||||
<AccountPageFooter>
|
||||
<p>Remember your password? <Link to="/login">Log In</Link>.</p>
|
||||
</AccountPageFooter>
|
||||
</form>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>);
|
||||
}
|
||||
}
|
||||
|
||||
RecoverPassword.propTypes = {
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default RecoverPassword;
|
||||
|
|
@ -6,6 +6,7 @@ import { Accounts } from 'meteor/accounts-base';
|
|||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import OAuthLoginButton from '../../components/OAuthLoginButton/OAuthLoginButton';
|
||||
import InputHint from '../../components/InputHint/InputHint';
|
||||
import AccountPageFooter from '../../components/AccountPageFooter/AccountPageFooter';
|
||||
import validate from '../../../modules/validate';
|
||||
|
||||
import './Signup.scss';
|
||||
|
|
@ -138,9 +139,9 @@ class Signup extends React.Component {
|
|||
<InputHint>Use at least six characters.</InputHint>
|
||||
</FormGroup>
|
||||
<Button type="submit" bsStyle="success">Sign Up</Button>
|
||||
<p className="HaveAnAccount">
|
||||
Already have an account? <Link to="/login">Log In</Link>.
|
||||
</p>
|
||||
<AccountPageFooter>
|
||||
<p>Already have an account? <Link to="/login">Log In</Link>.</p>
|
||||
</AccountPageFooter>
|
||||
</form>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -16,11 +16,5 @@
|
|||
left: 50%;
|
||||
margin-left: -106px;
|
||||
}
|
||||
|
||||
.HaveAnAccount {
|
||||
margin-top: 25px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid $gray-lighter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@cleverbeagle/dates": "^0.2.0",
|
||||
"@cleverbeagle/seeder": "^0.3.0",
|
||||
"babel-runtime": "^6.20.0",
|
||||
"bcrypt": "^1.0.2",
|
||||
"jquery": "^2.2.4",
|
||||
"jquery-validation": "^1.16.0",
|
||||
"meteor-node-stubs": "~0.2.4",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue