Skip to content

Commit 1b2cbd9

Browse files
author
EC2 Default User
committed
2.0.10-beta1: Convert Accounts.js to class
1 parent 29a64de commit 1b2cbd9

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@meteorrn/core",
3-
"version": "2.0.9",
3+
"version": "2.0.10-beta1",
44
"description": "Full Meteor Client for React Native",
55
"main": "src/Meteor.js",
66
"repository": {

src/user/Accounts.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import User from './User';
44
import { hashPassword } from '../../lib/utils';
55
import {isVerbose} from '../Meteor.js';
66

7-
module.exports = {
8-
_hashPassword:hashPassword,
9-
createUser(options, callback = () => {}) {
7+
class AccountsPassword {
8+
_hashPassword = hashPassword;
9+
10+
createUser = (options, callback = () => {}) => {
1011
if (options.username) options.username = options.username;
1112
if (options.email) options.email = options.email;
1213

@@ -21,8 +22,9 @@ module.exports = {
2122
User._handleLoginCallback(err, result);
2223
callback(err);
2324
});
24-
},
25-
changePassword(oldPassword, newPassword, callback = () => {}) {
25+
};
26+
27+
changePassword = (oldPassword, newPassword, callback = () => {}) => {
2628
//TODO check Meteor.user() to prevent if not logged
2729

2830
if (typeof newPassword != 'string' || !newPassword) {
@@ -37,17 +39,19 @@ module.exports = {
3739
callback(err);
3840
}
3941
);
40-
},
41-
forgotPassword(options, callback = () => {}) {
42+
}
43+
44+
forgotPassword = (options, callback = () => {}) => {
4245
if (!options.email) {
4346
return callback('Must pass options.email');
4447
}
4548

4649
call('forgotPassword', options, err => {
4750
callback(err);
4851
});
49-
},
50-
resetPassword(token, newPassword, callback = () => {}) {
52+
};
53+
54+
resetPassword = (token, newPassword, callback = () => {}) => {
5155
if (!newPassword) {
5256
return callback('Must pass a new password');
5357
}
@@ -61,11 +65,15 @@ module.exports = {
6165

6266
callback(err);
6367
});
64-
},
65-
onLogin(cb) {
68+
};
69+
70+
onLogin = (cb) => {
6671
Data.on('onLogin', cb);
67-
},
68-
onLoginFailure(cb) {
72+
};
73+
74+
onLoginFailure = (cb) => {
6975
Data.on('onLoginFailure', cb);
70-
},
71-
};
76+
}
77+
}
78+
79+
export default new AccountsPassword();

0 commit comments

Comments
 (0)