Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function logValue(){
- var profileConfig = ServiceConfiguration.configurations.findOne({service: 'password'});
- var coinConfig = ServiceConfiguration.configurations.findOne({service: 'coinbase'});
- var googleConfig = ServiceConfiguration.configurations.findOne({service: 'google'});
- if (!Meteor.user())
- return 0;
- else if (coinConfig && !profileConfig)
- return 1;
- else if (googleConfig && !profileConfig)
- return 2;
- else
- return 3;
- }
- // This is a substitute for {{#if currentUser}}
- Template.registerHelper('currentProfile', function(){
- if (logValue()!==3)
- return false;
- else
- return true;
- });
- 'submit form': function(event,template){
- event.preventDefault();
- var nameVar = template.find('#name').value;
- var emailVar = template.find('#email').value;
- var passVar = template.find('#password').value;
- const info = {
- id: Meteor.userId(),
- prof: {
- $set: {
- emails : [
- {
- address : emailVar,
- verified : false,
- }
- ],
- profile : {
- name : nameVar,
- }
- },
- },
- pass: passVar,
- };
- Meteor.call('updateUser', (info),
- (err) => {
- if (err) {
- alert(err);
- }
- }
- );
- }
- updateUser: (info) => {
- var pass = passHash(info.pass);
- Meteor.users.update({_id: Meteor.userId()},info.prof);
- Meteor.users.update({_id: Meteor.userId()},
- {
- $set: {
- services: {
- password: {
- bcrypt: pass,
- },
- },
- }
- }
- );
- },
- Accounts.setPassword(userId, newPassword, [options])
- // This is right before I update the information. The account made
- with the coinbase login similar to other
- // packages like accounts-facebook, and accounts-google
- {
- "_id" : "5dNYmJp9APCgxi8se",
- "createdAt" : ISODate("2018-06-15T21:14:38.276Z"),
- "services" : {
- "coinbase" : {
- COINBASE PROVIDED INFO },
- "resume" : {
- "loginTokens" : [
- {
- LOGIN STUFF
- }
- ]
- }
- },
- "profile" : {
- COINBASE MADE PROFILE
- }
- }
- //This is what happens when I update an account with my registration form submission.
- {
- "_id" : "fxTu4YuhBsAvz2Gey",
- "createdAt" : ISODate("2018-06-15T21:21:32.710Z"),
- "services" : {
- "password" : {some hashed password havnt gotten that working yet}
- },
- "profile" : {
- "name" : "New Reconfimed and updated info"
- },
- "emails" : [
- {
- "address" : "sdfsdfsd@sdfsd",
- "verified" : false
- }
- ]
- }
Add Comment
Please, Sign In to add comment