I'm trying to implement a custom login using React and the accounts-base, accounts-password packages.
registration
handleRegistrationSubmit(event){
event.preventDefault();
var email = React.findDOMNode(this.refs.emailInputReg).value.trim();
var password = React.findDOMNode(this.refs.passwordInputReg).value.trim();
Accounts.createUser({
email: email,
password: password
})
},
login
handleLoginSubmit(event){
event.preventDefault();
var email = React.findDOMNode(this.refs.emailInputLogin).value.trim();
var password = React.findDOMNode(this.refs.passwordInputLogin).value.trim();
Meteor.loginWithPassword(email, password, function(err){
if (err){
console.log(err)
}
});
},
logout
handleLogout(event){
event.preventDefault();
Meteor.logout(function(err){
if(err){
console.log(err)
}
});
},
The registration works well and a new user is created and logged in. if i go to the console and type
Meteor.users.find().fetch()
it return the user just created with the _id and email field.
When i logout the email field disappears and the user has only the _id field.
If i try to login it says
User not found [403]
I can't understand why only the email field is deleted but the user object persists. No error is shown in the registration and in the logout. I've no idea why is this happening.
Thanks for your help
Ok.. solved. It seems that if the format of email is wrong after the logout it's deleted. I don't know why but if i try with "[email protected]" it works, but with "test" the user is created and after the logout the email field is removed