Skip to content

Commit 9026e76

Browse files
committed
add 2fa login
1 parent 6fd0e17 commit 9026e76

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/user/User.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ const User = {
7373
}
7474
);
7575
},
76+
loginWithPasswordAnd2faCode(selector, password, code, callback) {
77+
this._isTokenLogin = false;
78+
if (typeof selector === 'string') {
79+
if (selector.indexOf('@') === -1) selector = { username: selector };
80+
else selector = { email: selector };
81+
}
82+
83+
User._startLoggingIn();
84+
Meteor.call(
85+
'login',
86+
{
87+
user: selector,
88+
password: hashPassword(password),
89+
code,
90+
},
91+
(err, result) => {
92+
User._handleLoginCallback(err, result);
93+
94+
typeof callback == 'function' && callback(err);
95+
}
96+
);
97+
},
7698
logoutOtherClients(callback = () => {}) {
7799
Meteor.call('getNewToken', (err, res) => {
78100
if (err) return callback(err);

0 commit comments

Comments
 (0)