Advertisement
Guest User

Untitled

a guest
Feb 9th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. var _ = require('underscore');
  2. var md5 = require('js-md5');
  3.  
  4. var v1accountapi = {
  5. me: function () {
  6. this.api.forceV1(true);
  7. this.api.send('ajax', 'userDetail', { chat: 1, from: 'self' });
  8. return this;
  9. },
  10. id: function (id) {
  11. this.api.forceV1(true);
  12. this.api.send('ajax', 'userDetail', { chat: 1, from: id });
  13. return this;
  14. },
  15. details: function () {
  16. this.api.forceV1(true);
  17. this.api.send('ajax', 'accountDetail', { from: 'self' });
  18. return this;
  19. },
  20. users: function (account) {
  21. this.api.forceV1(true);
  22. var options = {};
  23. if(account) {
  24. options.force = account;
  25. }
  26. this.api.send('ajax', 'users', options);
  27. return this;
  28. },
  29. forgot: function (email) {
  30. this.api.forceV1(true);
  31. var options = {
  32. email: email,
  33. login: 1};
  34. this.api.send('ajax', 'forgot', options);
  35. return this;
  36. },
  37. forgotPassword: function (options) {
  38. this.api.forceV1(true);
  39. var _options = {
  40. email: "",
  41. login: 1,
  42. key: md5(options.email + "wsLostPass")
  43. };
  44. var post = _.extend(_options, options);
  45. this.api.send('ajax', 'forgot2', post);
  46. return this;
  47. },
  48. changePassword: function (options, newpassword) {
  49. this.api.forceV1(true);
  50. var options = {
  51. id :'',
  52. pass :'',
  53. key:md5(pass + 'wsLostPass')
  54. };
  55. //var post = _.extend(options);
  56. this.api.send('ajax', 'changePass', options);
  57. console.log('_OPPPTTTIONNNSSSSS', options);
  58.  
  59. return this;
  60. },
  61. offline: function (post) {
  62.  
  63. this.api.forceV1(true);
  64. var options = {
  65. id: post.userId,
  66. type: 'user'
  67. };
  68.  
  69. this.api.send('ajax', 'offline', options);
  70. return this;
  71. },
  72. delete: function (post) {
  73. this.api.forceV1(true);
  74. var options = {
  75. id: post.user.id,
  76. type: 'user'
  77. };
  78. this.api.send('ajax', 'delete', options);
  79. return this;
  80. },
  81.  
  82. sid: function () {
  83. this.api.forceV1(true);
  84. this.api.send('ajax', 'sid', { v2: 1});
  85. return this;
  86. },
  87. auth: function (user, pass) {
  88. this.api.forceV1(true);
  89. this.api.send('ajax', 'connexion',
  90. {
  91. langue: '-',
  92. user: user,
  93. pass: pass
  94. });
  95. return this;
  96.  
  97. },
  98. change: function (id) {
  99. var type = id.substr(0, 1);
  100. var id = id.substr(1);
  101.  
  102. var main = 'changeid';
  103. var cmd = 'changeid';
  104. var options = {
  105. json: 1
  106. }
  107. if(type == 's') {
  108. main = 'ajax';
  109. cmd = 'changesid';
  110. options.sid = id;
  111.  
  112. } else {
  113. options.id = id;
  114. }
  115. this.api.forceV1(true);
  116. this.api.send(main, cmd, options);
  117. return this;
  118. },
  119. add: function (user) {
  120. this.api.forceV1(true);
  121. this.api.send('ajax', 'saveDetails', user);
  122. return this;
  123. },
  124. edit: function (user) {
  125. this.api.forceV1(true);
  126. this.api.send('ajax', 'saveDetails', user);
  127. return this;
  128. },
  129. error: function (api){
  130. }
  131. }
  132.  
  133. module.exports = v1accountapi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement