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._endLoggingIn();
Meteor._handleLoginCallback(err, result); Meteor._handleLoginCallback(err, result);
if (err) { 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); reject(err);
} else { } else {
resolve(result); resolve(result);
@ -168,26 +173,6 @@ const RocketChat = {
return this.login(params, callback); 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) { loadSubscriptions(cb) {
Meteor.call('subscriptions/get', (err, data) => { Meteor.call('subscriptions/get', (err, data) => {
if (err) { if (err) {

View File

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