add support for profile
This commit is contained in:
parent
779e3ee978
commit
252ebf50cc
7 changed files with 268 additions and 1 deletions
33
imports/api/Users/server/methods.js
Normal file
33
imports/api/Users/server/methods.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { check, Match } from 'meteor/check';
|
||||
import editProfile from '../../../modules/server/edit-profile';
|
||||
import rateLimit from '../../../modules/rate-limit';
|
||||
|
||||
Meteor.methods({
|
||||
'users.editProfile': function usersEditProfile(profile) {
|
||||
check(profile, {
|
||||
emailAddress: String,
|
||||
password: Match.Optional(Object),
|
||||
profile: {
|
||||
name: {
|
||||
first: String,
|
||||
last: String,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return editProfile({ userId: this.userId, profile })
|
||||
.then(response => response)
|
||||
.catch((exception) => {
|
||||
throw new Meteor.Error('500', exception);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
rateLimit({
|
||||
methods: [
|
||||
'users.editProfile',
|
||||
],
|
||||
limit: 5,
|
||||
timeRange: 1000,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue