Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created June 18, 2019 06:26
Show Gist options
  • Save tkssharma/4d5ffde9f6c6d5153f64eca4cd9b287e to your computer and use it in GitHub Desktop.
Save tkssharma/4d5ffde9f6c6d5153f64eca4cd9b287e to your computer and use it in GitHub Desktop.
getUserData() {
const id = Meteor.userId();
if (id) {
const data = Meteor.users.findOne({ _id: id });
if(data){
console.log(data)
}
}
}
handleLogin(data) {
Meteor.loginWithPassword(data.email, data.password, (err) => {
if (err) {
console.log(err)
}
else {
console.log('logged in ')
}
})
}
handleForgotPassword(data) {
Accounts.forgotPassword({ email: data.email }, (err) => {
if (err) {
console.log(err.message ? err.message : 'error occured')
} else {
console.log('password reset mail has been sent');
}
})
}
handleResetPassword(data) {
Accounts.resetPassword(data.token, data.password, (err) => {
if (err) {
console.log(err.message ? err.message : 'error occured')
}
})
}
handleRegister(data) {
Accounts.createUser({
email: data.email,
password: data.password,
username: data.username,
}, (err) => {
if (!err) {
// TBD
} else {
// TBD
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment