Created
June 18, 2019 06:26
-
-
Save tkssharma/4d5ffde9f6c6d5153f64eca4cd9b287e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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