AllenYuan

auth - login view - attach handlers

Apr 24th, 2020
966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ...
  2.  
  3.   render() {
  4.     const { email, password } = this.props;
  5.     return (
  6.       <div className="auth-page">
  7.         {/* fixed width responsive container */}
  8.         <div className="container page">
  9.           {/* row to wrap column */}
  10.           <div className="row">
  11.             {/* add bootstrap column classes to align form elements and
  12.             use offset to center the column */}
  13.             <div className="col-md-6 offset-md-3 col-xs-12">
  14.               <h1 className="text-xs-center">Sign In</h1>
  15.               <p className="text-xs-center">
  16.                 <a>
  17.                   Need an account?
  18.                 </a>
  19.               </p>
  20.  
  21.               <ListErrors errors={this.props.errors} />
  22.               {/* login form */}
  23.               <form> onSubmit={this.submitForm(email, password)}>
  24.                 <fieldset>
  25.                   {/* email input */}
  26.                   <fieldset className="form-group">
  27.                     {/* on change update email in state */}
  28.                     <input
  29.                       className="form-control form-control-lg"
  30.                       type="email"
  31.                       placeholder="Email"
  32.                       value={email}
  33.                       onChange={this.changeEmail} />
  34.                   </fieldset>
  35.                   {/* on change update password in state */}
  36.                   <fieldset className="form-group">
  37.                     <input
  38.                       className="form-control form-control-lg"
  39.                       type="password"
  40.                       placeholder="Password"
  41.                       value={password}
  42.                       onChange={this.changePassword} />
  43.                   </fieldset>
  44.                   {/* submit button */}
  45.                   <button
  46.                     className="btn btn-lg btn-primary pull-xs-right"
  47.                     type="submit"
  48.                     disabled={this.props.inProgress}>
  49.                     Sign in
  50.                   </button>
  51.                 </fieldset>
  52.               </form>
  53.             </div>
  54.           </div>
  55.         </div>
  56.       </div>
  57.     );
  58.   }
  59. }
  60.  
  61. export default connect(mapStateToProps, mapDispatchToProps)(Login);
Advertisement
Add Comment
Please, Sign In to add comment