Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. var options = {
  2. storeBlank: false,
  3. cookieOptions: {
  4. password: 'the-password-must-be-at-least-32-characters-long',
  5. isSecure: true
  6. }
  7. };
  8. server.register({
  9. register: Yar,
  10. options: options
  11. }, function (err) { });
  12.  
  13. server.route({
  14. method:'POST',
  15. path:'/form',
  16. handler:function (request,reply) {
  17. const user = request.payload;
  18. console.log("Username : "+user.username);
  19. console.log("Password : "+user.password);
  20. console.log("Name : "+user.name);
  21. console.log("Surname : "+user.surname);
  22. request.log(['error', 'login'], err);
  23. request.session.flash('error', 'There was an error logging in. Try again.');
  24. return reply.redirect('/form');
  25. },
  26. config: {
  27. validate: {
  28. payload: {
  29. username: Joi.string().required(),
  30. password: Joi.string().required(),
  31. name: Joi.string().required(),
  32. surname: Joi.string().required(),
  33. }
  34. }
  35. }
  36. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement