message on invalid password

This commit is contained in:
Guilherme Gazzo 2017-11-20 15:27:34 -02:00
parent cfcc481bdc
commit 8243593716
2 changed files with 6 additions and 25 deletions

View File

@ -92,6 +92,11 @@ const RocketChat = {
Meteor._endLoggingIn();
Meteor._handleLoginCallback(err, result);
if (err) {
if (/user not found/i.test(err.reason)) {
err.error = 1;
err.reason = 'User or Password incorrect';
err.message = 'User or Password incorrect';
}
reject(err);
} else {
resolve(result);
@ -168,26 +173,6 @@ const RocketChat = {
return this.login(params, callback);
},
// loadRooms(cb) {
// console.warn('a');
// Meteor.call('rooms/get', (err, data) => {
// if (err) {
// console.error(err);
// }
// console.warn(`rooms ${ data.length }`);
// if (data.length) {
// realm.write(() => {
// data.forEach((room) => {
// room._server = { id: reduxStore.getState().server.server };
// realm.create('rooms', room, true);
// });
// });
// }
// return cb && cb();
// });
// },
loadSubscriptions(cb) {
Meteor.call('subscriptions/get', (err, data) => {
if (err) {

View File

@ -83,11 +83,7 @@ const handleLoginRequest = function* handleLoginRequest({ credentials }) {
yield put(loginSuccess(user));
} catch (err) {
if (err.error === 403) {
yield put(logout());
} else {
yield put(loginFailure(err));
}
yield put(loginFailure(err));
}
};