Hey folks.
I’m about 60% through my Meteor app, just got cloudinary picture upload for posts, and now am hoping to allow user’s to upload profile pictures.
I am using the standard accounts-password package for my user management, and have been trying to use autoform and simpleschema + collection2 to allow a user to upload extra details to their profile as well (bio, website, company, etc).
This all works fine, and saves the photo to cloudinary (user is created, I see in robomongo) - but I can’t for the life of my get the password field to work/show up.
My first idea was to set a password field in the Meteor.users schema, but the password is not saved as the user’s password, just another field in the collection.
After that I found that the password field is in the services : {} field in the user’s collection, but now I can’t get anything in the Services field to show up on autoform.
I am using a schema similar to this one (taken from meteor-starter project).
But like I said, the autoform doesn’t show a password field.
Schemas.UserProfile = new SimpleSchema({
picture: {
type: String,
optional: true,
label: ‘Profile picture’,
autoform: {
afFieldInput: {
type: ‘fileUpload’,
collection: ‘ProfilePictures’
}
}
},
firstName: {
type: String,
optional: true
},
lastName: {
type: String,
optional: true
},
birthday: {
type: Date,
optional: true
},
bio: {
type: String,
optional: true,
autoform: {
rows: 4
}
},
location: {
type: String,
optional: true,
autoform: {
type: ‘map’,
geolocation: true,
searchBox: true,
autolocate: true
}
}
});
Schemas.User = new SimpleSchema({
username: {
type: String,
regEx: /^[a-z0-9A-Z_]{3,15}$/,
optional: true
},
emails: {
type: [Object],
optional: true
},
“emails.$.address”: {
type: String,
regEx: SimpleSchema.RegEx.Email
},
“emails.$.verified”: {
type: Boolean
},
createdAt: {
type: Date
},
profile: {
type: Schemas.UserProfile,
optional: true
},
services: {
type: Object,
optional: true,
blackbox: true
},
roles: {
type: [String],
blackbox: true,
optional: true
}
});
Meteor.users.attachSchema(Schemas.User);
I might be going about this the wrong way, but essentially in the end I just want a way for a user to upload a profile picture, and eventually save favourites and such to their account.
Can anyone guide me in the right direction for this?
Thanks so much.