Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. authToken = req.headers.authorization;
  2. userAuthObj = JSON.parse(UserAuthServices.userAuthTokenValidator(authToken));
  3. var todayDate = new Date();
  4. var expireDate = new Date(userAuthObj.expire_date);
  5. tokenOK = TokenValidator.validateToken(userAuthObj.user_id, authToken).then(function (userSessions) {
  6. if (userSessions.length === 1) {
  7. if (expireDate >= todayDate) {
  8. template_id = req.params.id;
  9. image_id = req.params.img_id;
  10. TemplateController.findById(template_id, {
  11. attributes: {
  12. exclude: ['created_by', 'created_on', 'updated_by', 'updated_on']
  13. },
  14. include: [{
  15. attributes: {
  16. exclude: ['created_by', 'created_on', 'updated_by', 'updated_on']
  17. },
  18. model: Broadcasting,
  19.  
  20. where: {
  21. id: image_id,
  22.  
  23. }
  24. },
  25.  
  26. ]
  27. }
  28.  
  29. ).then(function (templatefindByid) {
  30.  
  31.  
  32.  
  33. BccSetting.findAll({
  34. where: {
  35. template_id: template_id
  36. }
  37. }).then(bccSettings => {
  38.  
  39.  
  40. res.status(200).json({
  41. id: templatefindByid.id,
  42. name: templatefindByid.name,
  43. template_images: templatefindByid.template_images,
  44. bcc_settings: bccSettings,
  45.  
  46.  
  47. })
  48. }).catch(err => {
  49. console.log(err);
  50. res.status(404).json({
  51. message: ' not found...'
  52. });
  53. });
  54. }).catch(function (err) {
  55. console.log(err);
  56. res.status(404).json({
  57. message: 'not found...'
  58. });
  59. });
  60. } else {
  61. res.status(401).json({
  62. message: 'Not ...'
  63. });
  64. }
  65. } else {
  66. res.status(401).json({
  67. message: 'Expired...'
  68. });
  69. }
  70. }).catch(function (err) {
  71. res.status(401).json({
  72. message: 'Expired...'
  73.  
  74. });
  75. });
  76.  
  77. host: 'smtp.gmail.com',
  78. port: 465,
  79. auth: true,
  80. active: true,
  81. secure: true,
  82. requireTLS: true,
  83. auth: {
  84. user: 'trans@gmail.com',
  85. pass: 'wertyy'
  86. }
  87.  
  88. from: 'trans@gmail.com',
  89. to: 'wwww@gmail.com',
  90. bcc: bcc_setting.bcc_setting,// here i want bcc setting data
  91. subject: 'yvnuyybymyed',
  92. html: 'result'
  93.  
  94. if (error) {
  95. return console.log("mail not sent" + error.message);
  96. }
  97. console.log('success');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement