1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

form password + signup

This commit is contained in:
ddejongh 2015-06-11 17:22:11 +02:00
parent 5e746295bc
commit 0f1108b14e
5 changed files with 177 additions and 2 deletions

View File

@ -23,7 +23,7 @@ fetch.defaults({
urlMap: ApiUrls,
http: {
headers: headers,
credentials: 'include'
credentials: 'cors'
},
fatalErrorHandler: (err) => {
console.log(err);

View File

@ -0,0 +1,51 @@
'use strict';
import React from 'react';
import apiUrls from '../../constants/api_urls';
import FormMixin from '../../mixins/form_mixin';
import InputText from './input_text';
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
let PasswordResetForm = React.createClass({
mixins: [FormMixin],
url() {
return apiUrls.users_password_reset;
},
getFormData() {
return {
email: this.props.email,
token: this.props.token,
password: this.refs.password.state.value,
password_confirm: this.refs.password_confirm.state.value
};
},
renderForm() {
return (
<form id="reset_password_modal_content" role="form" onSubmit={this.submit}>
<div>Reset the password for {this.props.email}:</div>
<InputText
ref="password"
placeHolder="Choose a password"
required="required"
type="password"
submitted={this.state.submitted}/>
<InputText
ref="password_confirm"
placeHolder="Confirm password"
required="required"
type="password"
submitted={this.state.submitted}/>
<ButtonSubmitOrClose
text="RESET PASSWORD"
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);
}
});
export default PasswordResetForm;

View File

@ -0,0 +1,41 @@
'use strict';
import React from 'react';
import apiUrls from '../../constants/api_urls';
import FormMixin from '../../mixins/form_mixin';
import InputText from './input_text';
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
let PasswordResetRequestForm = React.createClass({
mixins: [FormMixin],
url() {
return apiUrls.users_password_reset_request;
},
getFormData() {
return {
email: this.refs.email.state.value
};
},
renderForm() {
return (
<form id="request_reset_password_modal_content" role="form" onSubmit={this.submit}>
<InputText
ref="email"
placeHolder="Email"
required="required"
type="email"
submitted={this.state.submitted}/>
<ButtonSubmitOrClose
text="RESET PASSWORD"
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);
}
});
export default PasswordResetRequestForm;

View File

@ -0,0 +1,80 @@
'use strict';
import React from 'react';
import apiUrls from '../../constants/api_urls';
import FormMixin from '../../mixins/form_mixin';
import InputText from './input_text';
import InputCheckbox from './input_checkbox';
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
let SignupForm = React.createClass({
mixins: [FormMixin],
url() {
return apiUrls.users_signup;
},
getFormData() {
return {
email: this.refs.email.state.value,
password: this.refs.password.state.value,
password_confirm: this.refs.password_confirm.state.value,
terms: this.refs.terms.state.value,
promo_code: this.refs.promo_code.state.value
};
},
renderForm() {
return (
<form id="signup_modal_content" role="form" onSubmit={this.submit}>
<input className="invisible" type="email" name="fake_consignee"/>
<input className="invisible" type="password" name="fake_password"/>
<InputText
ref="email"
placeHolder="Email"
required="required"
type="email"
submitted={this.state.submitted}/>
<InputText
ref="password"
placeHolder="Choose a password"
required="required"
type="password"
submitted={this.state.submitted}/>
<InputText
ref="password_confirm"
placeHolder="Confirm password"
required="required"
type="password"
submitted={this.state.submitted}/>
<div>
Your password must be at least 10 characters.
This password is securing your digital property like a bank account.
Store it in a safe place!
</div>
<InputCheckbox
ref="terms"
required="required"
label={
<div>
I agree to the&nbsp;
<a href="/terms" target="_blank"> Terms of Service</a>
</div>}
/>)
<InputText
ref="promo_code"
placeHolder="Promocode (Optional)"
required=""
type="text"
submitted={this.state.submitted}/>
<ButtonSubmitOrClose
text="JOIN US"
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);
}
});
export default SignupForm;

View File

@ -23,7 +23,10 @@ let apiUrls = {
'ownership_loans_deny': AppConstants.apiEndpoint + 'ownership/loans/deny/',
'note_notes': AppConstants.apiEndpoint + 'note/notes/',
'user': AppConstants.apiEndpoint + 'users/',
'users_login': AppConstants.apiEndpoint + 'users/login/'
'users_login': AppConstants.apiEndpoint + 'users/login/',
'users_signup': AppConstants.apiEndpoint + 'users/',
'users_password_reset_request': AppConstants.apiEndpoint + 'users/request_reset_password/',
'users_password_reset': AppConstants.apiEndpoint + 'users/reset_password/'
};
export default apiUrls;