Applied style rules to genocide all \t characters
This commit is contained in:
@@ -3,8 +3,8 @@ import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||
|
||||
const removeEmail = new ValidatedMethod({
|
||||
name: 'users.removeEmail',
|
||||
validate: new SimpleSchema({
|
||||
name: 'users.removeEmail',
|
||||
validate: new SimpleSchema({
|
||||
email: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Email,
|
||||
@@ -15,23 +15,23 @@ const removeEmail = new ValidatedMethod({
|
||||
numRequests: 1,
|
||||
timeInterval: 5000,
|
||||
},
|
||||
run({email}){
|
||||
run({ email }) {
|
||||
const userId = Meteor.userId();
|
||||
const user = Meteor.users.findOne(userId);
|
||||
if (!user) throw new Meteor.Error('No user',
|
||||
'You must be logged in to remove an email address');
|
||||
if (!user.emails){
|
||||
'You must be logged in to remove an email address');
|
||||
if (!user.emails) {
|
||||
throw new Meteor.Error('No email to remove',
|
||||
'No email addresses are associated with this account');
|
||||
'No email addresses are associated with this account');
|
||||
}
|
||||
if (user.emails.length == 1){
|
||||
if (user.emails.length == 1) {
|
||||
throw new Meteor.Error('Can\'t remove last email',
|
||||
'You may not remove the last email address from your account');
|
||||
'You may not remove the last email address from your account');
|
||||
}
|
||||
if (Meteor.isServer){
|
||||
if (Meteor.isServer) {
|
||||
Accounts.removeEmail(userId, email);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default removeEmail;
|
||||
|
||||
Reference in New Issue
Block a user