mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
signup process complete + subdomained
This commit is contained in:
parent
8fc400bb01
commit
6660065cad
@ -14,6 +14,7 @@ import Property from './ascribe_forms/property';
|
||||
import apiUrls from '../constants/api_urls';
|
||||
import AppConstants from '../constants/application_constants';
|
||||
|
||||
let Link = Router.Link;
|
||||
|
||||
let LoginContainer = React.createClass({
|
||||
mixins: [Router.Navigation],
|
||||
@ -46,7 +47,6 @@ let LoginContainer = React.createClass({
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
Log in to ascribe...
|
||||
</div>
|
||||
|
||||
<LoginForm />
|
||||
</div>
|
||||
);
|
||||
@ -108,8 +108,8 @@ let LoginForm = React.createClass({
|
||||
</Property>
|
||||
<hr />
|
||||
<div className="ascribe-login-text">
|
||||
Not an ascribe user? Sign up...<br/>
|
||||
Forgot my password? Rescue me...
|
||||
Not an ascribe user? <Link to="signup">Sign up...</Link><br/>
|
||||
Forgot my password? <Link to="password_reset">Rescue me...</Link>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
|
@ -3,28 +3,160 @@
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
|
||||
import PasswordResetForm from './ascribe_forms/form_password_reset';
|
||||
import Form from './ascribe_forms/form';
|
||||
import Property from './ascribe_forms/property';
|
||||
|
||||
import apiUrls from '../constants/api_urls';
|
||||
|
||||
import GlobalNotificationModel from '../models/global_notification_model';
|
||||
import GlobalNotificationActions from '../actions/global_notification_actions';
|
||||
|
||||
let PasswordResetContainer = React.createClass({
|
||||
mixins: [Router.Navigation],
|
||||
getInitialState() {
|
||||
return {isRequested: false};
|
||||
},
|
||||
handleRequestSuccess(email){
|
||||
this.setState({isRequested: email});
|
||||
},
|
||||
render() {
|
||||
if (this.props.query.email && this.props.query.token) {
|
||||
return (
|
||||
<div>
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
Reset the password for {this.props.query.email}
|
||||
</div>
|
||||
<PasswordResetForm
|
||||
email={this.props.query.email}
|
||||
token={this.props.query.token}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (this.state.isRequested === false) {
|
||||
return (
|
||||
<div>
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
Reset your ascribe password
|
||||
</div>
|
||||
<PasswordRequestResetForm
|
||||
handleRequestSuccess={this.handleRequestSuccess}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else if (this.state.isRequested) {
|
||||
return (
|
||||
<div>
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
An email has been sent to "{this.state.isRequested}"
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else {
|
||||
return <span />;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
handleSuccess(){
|
||||
let PasswordRequestResetForm = React.createClass({
|
||||
handleSuccess() {
|
||||
let notificationText = 'Request succesfully sent, check your email';
|
||||
let notification = new GlobalNotificationModel(notificationText, 'success', 50000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
this.props.handleRequestSuccess(this.refs.form.refs.email.state.value);
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<Form
|
||||
ref="form"
|
||||
url={apiUrls.users_password_reset_request}
|
||||
handleSuccess={this.handleSuccess}
|
||||
buttons={
|
||||
<button
|
||||
type="submit"
|
||||
className="btn ascribe-btn ascribe-btn-login">
|
||||
Reset your password
|
||||
</button>}
|
||||
spinner={
|
||||
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||
</button>
|
||||
}>
|
||||
<Property
|
||||
name='email'
|
||||
label="Email">
|
||||
<input
|
||||
type="email"
|
||||
placeholder="Enter your email and we'll send a link"
|
||||
name="email"
|
||||
required/>
|
||||
</Property>
|
||||
<hr />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let PasswordResetForm = React.createClass({
|
||||
mixins: [Router.Navigation],
|
||||
|
||||
getFormData(){
|
||||
let data = {};
|
||||
for (let ref in this.refs.form.refs){
|
||||
data[this.refs.form.refs[ref].props.name] = this.refs.form.refs[ref].state.value;
|
||||
}
|
||||
data.digital_work_key = this.state.digitalWorkKey;
|
||||
data.email = this.props.email;
|
||||
data.token = this.props.token;
|
||||
return data;
|
||||
},
|
||||
handleSuccess() {
|
||||
this.transitionTo('pieces');
|
||||
let notification = new GlobalNotificationModel('password succesfully updated', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<PasswordResetForm
|
||||
email={this.props.query.email}
|
||||
token={this.props.query.token}
|
||||
<Form
|
||||
ref="form"
|
||||
url={apiUrls.users_password_reset}
|
||||
handleSuccess={this.handleSuccess}
|
||||
/>
|
||||
);
|
||||
}
|
||||
getFormData={this.getFormData}
|
||||
buttons={
|
||||
<button
|
||||
type="submit"
|
||||
className="btn ascribe-btn ascribe-btn-login">
|
||||
Reset your password
|
||||
</button>}
|
||||
spinner={
|
||||
<button className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||
</button>
|
||||
}>
|
||||
<Property
|
||||
name='password'
|
||||
label="Password">
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Enter a new password"
|
||||
name="password"
|
||||
required/>
|
||||
</Property>
|
||||
<Property
|
||||
name='password_confirm'
|
||||
label="Confirm password">
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Enter your password once again"
|
||||
name="password"
|
||||
required/>
|
||||
</Property>
|
||||
<hr />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default PasswordResetContainer;
|
Loading…
Reference in New Issue
Block a user