Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var _ = require('underscore');
- var md5 = require('js-md5');
- var v1accountapi = {
- me: function () {
- this.api.forceV1(true);
- this.api.send('ajax', 'userDetail', { chat: 1, from: 'self' });
- return this;
- },
- id: function (id) {
- this.api.forceV1(true);
- this.api.send('ajax', 'userDetail', { chat: 1, from: id });
- return this;
- },
- details: function () {
- this.api.forceV1(true);
- this.api.send('ajax', 'accountDetail', { from: 'self' });
- return this;
- },
- users: function (account) {
- this.api.forceV1(true);
- var options = {};
- if(account) {
- options.force = account;
- }
- this.api.send('ajax', 'users', options);
- return this;
- },
- forgot: function (email) {
- this.api.forceV1(true);
- var options = {
- email: email,
- login: 1};
- this.api.send('ajax', 'forgot', options);
- return this;
- },
- forgotPassword: function (options) {
- this.api.forceV1(true);
- var _options = {
- email: "",
- login: 1,
- key: md5(options.email + "wsLostPass")
- };
- var post = _.extend(_options, options);
- this.api.send('ajax', 'forgot2', post);
- return this;
- },
- changePassword: function (options, newpassword) {
- this.api.forceV1(true);
- var options = {
- id :'',
- pass :'',
- key:md5(pass + 'wsLostPass')
- };
- //var post = _.extend(options);
- this.api.send('ajax', 'changePass', options);
- console.log('_OPPPTTTIONNNSSSSS', options);
- return this;
- },
- offline: function (post) {
- this.api.forceV1(true);
- var options = {
- id: post.userId,
- type: 'user'
- };
- this.api.send('ajax', 'offline', options);
- return this;
- },
- delete: function (post) {
- this.api.forceV1(true);
- var options = {
- id: post.user.id,
- type: 'user'
- };
- this.api.send('ajax', 'delete', options);
- return this;
- },
- sid: function () {
- this.api.forceV1(true);
- this.api.send('ajax', 'sid', { v2: 1});
- return this;
- },
- auth: function (user, pass) {
- this.api.forceV1(true);
- this.api.send('ajax', 'connexion',
- {
- langue: '-',
- user: user,
- pass: pass
- });
- return this;
- },
- change: function (id) {
- var type = id.substr(0, 1);
- var id = id.substr(1);
- var main = 'changeid';
- var cmd = 'changeid';
- var options = {
- json: 1
- }
- if(type == 's') {
- main = 'ajax';
- cmd = 'changesid';
- options.sid = id;
- } else {
- options.id = id;
- }
- this.api.forceV1(true);
- this.api.send(main, cmd, options);
- return this;
- },
- add: function (user) {
- this.api.forceV1(true);
- this.api.send('ajax', 'saveDetails', user);
- return this;
- },
- edit: function (user) {
- this.api.forceV1(true);
- this.api.send('ajax', 'saveDetails', user);
- return this;
- },
- error: function (api){
- }
- }
- module.exports = v1accountapi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement