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

password reset ok

This commit is contained in:
ddejongh 2015-06-15 16:56:17 +02:00
parent 8ceabda1c5
commit cf3b7f234d
4 changed files with 63 additions and 8 deletions

View File

@ -0,0 +1,27 @@
'use strict';
import React from 'react';
let ButtonSubmitOrClose = React.createClass({
propTypes: {
submitted: React.PropTypes.bool.isRequired,
text: React.PropTypes.string.isRequired
},
render() {
if (this.props.submitted){
return (
<div className="modal-footer">
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
</div>
);
}
return (
<div className="modal-footer">
<button type="submit" className="btn btn-ascribe-inv">{this.props.text}</button>
</div>
);
}
});
export default ButtonSubmitOrClose;

View File

@ -5,7 +5,7 @@ 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';
import ButtonSubmit from '../ascribe_buttons/button_submit';
let PasswordResetForm = React.createClass({
mixins: [FormMixin],
@ -13,7 +13,7 @@ let PasswordResetForm = React.createClass({
url() {
return apiUrls.users_password_reset;
},
getFormData() {
return {
email: this.props.email,
@ -39,9 +39,8 @@ let PasswordResetForm = React.createClass({
required="required"
type="password"
submitted={this.state.submitted}/>
<ButtonSubmitOrClose
<ButtonSubmit
text="RESET PASSWORD"
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);

View File

@ -0,0 +1,30 @@
'use strict';
import React from 'react';
import Router from 'react-router';
import PasswordResetForm from './ascribe_forms/form_password_reset';
import GlobalNotificationModel from '../models/global_notification_model';
import GlobalNotificationActions from '../actions/global_notification_actions';
let PasswordResetContainer = React.createClass({
mixins: [Router.Navigation],
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}
handleSuccess={this.handleSuccess}
/>
);
}
});
export default PasswordResetContainer;

View File

@ -6,9 +6,9 @@ import Router from 'react-router';
import AscribeApp from './components/ascribe_app';
import PieceList from './components/piece_list';
import EditionContainer from './components/edition_container';
import PasswordResetForm from './components/ascribe_forms/form_password_reset';
import PasswordResetContainer from './components/password_reset_container';
import AppConstants from './constants/application_constants';
import LoginModalHandler from './components/login_modal_handler';
//import LoginModalHandler from './components/login_modal_handler';
let Route = Router.Route;
let Redirect = Router.Redirect;
@ -17,10 +17,9 @@ let baseUrl = AppConstants.baseUrl;
let routes = (
<Route name="app" path={baseUrl} handler={AscribeApp}>
<Route name="login" path="*" handler={LoginModalHandler} />
<Route name="pieces" path="collection" handler={PieceList} />
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetForm} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Redirect from={baseUrl} to="pieces" />
<Redirect from={baseUrl + '/'} to="pieces" />