From 4f5e7a0821605a9963e5d79a1d9107c88304fb9f Mon Sep 17 00:00:00 2001 From: ddejongh Date: Thu, 11 Jun 2015 15:35:18 +0200 Subject: [PATCH 01/12] login form --- js/components/ascribe_forms/form_login.js | 57 +++++++++++++++++++++++ js/components/header.js | 17 ++++++- js/constants/api_urls.js | 7 ++- 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 js/components/ascribe_forms/form_login.js diff --git a/js/components/ascribe_forms/form_login.js b/js/components/ascribe_forms/form_login.js new file mode 100644 index 00000000..c768211f --- /dev/null +++ b/js/components/ascribe_forms/form_login.js @@ -0,0 +1,57 @@ +'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 LoginForm = React.createClass({ + mixins: [FormMixin], + + + url() { + return apiUrls.users_login; + }, + + getFormData() { + return { + email: this.refs.email.state.value, + password: this.refs.password.state.value + }; + }, + + renderForm() { + return ( +
+ + + + +
+ Forgot your password? Reset password. +
+
+ Not a member yet? Sign up. +
+ + + ); + } +}); + +export default LoginForm; \ No newline at end of file diff --git a/js/components/header.js b/js/components/header.js index 3df56afb..1c428419 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -1,7 +1,7 @@ 'use strict'; import React from 'react'; -import Router from 'react-router'; +//import Router from 'react-router'; import UserActions from '../actions/user_actions'; import UserStore from '../stores/user_store'; @@ -11,9 +11,12 @@ import Navbar from 'react-bootstrap/lib/Navbar'; import DropdownButton from 'react-bootstrap/lib/DropdownButton'; import MenuItem from 'react-bootstrap/lib/MenuItem'; +import ModalWrapper from '../components/ascribe_modal/modal_wrapper'; +import LoginForm from '../components/ascribe_forms/form_login'; + import { getLangText } from '../utils/lang_utils'; -let Link = Router.Link; +//let Link = Router.Link; let Header = React.createClass({ @@ -33,6 +36,9 @@ let Header = React.createClass({ onChange(state) { this.setState(state); }, + handleLoginSuccess(){ + UserActions.fetchCurrentUser(); + }, render() { return ( @@ -44,6 +50,13 @@ let Header = React.createClass({