Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <form onSubmit={this.handleLogin.bind(this)} action="/" method="post">
  2. <div>
  3. <label>Username:</label>
  4. <input type="text" name="username"/>
  5. </div>
  6. <div>
  7. <label>Password:</label>
  8. <input type="password" name="password"/>
  9. </div>
  10. <div>
  11. <input type="submit" value="Log In"/>
  12. </div>
  13. </form>
  14.  
  15. handleLogin(){
  16. fetch('http://localhost:8080', {
  17. method: 'post',
  18. body: JSON.stringify({
  19. username: this.state.username,
  20. password: this.state.password
  21.  
  22. })
  23. })
  24.  
  25. }
  26.  
  27. app.post('/', function(req, res, next) {
  28. console.log("post");
  29. passport.authenticate('register', function(err, user, info) {
  30. console.log("authenticate");
  31. })(req, res, next);
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement