本文整理汇总了TypeScript中meteor/random.Random.hexString方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Random.hexString方法的具体用法?TypeScript Random.hexString怎么用?TypeScript Random.hexString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meteor/random.Random
的用法示例。
在下文中一共展示了Random.hexString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
invite: function (user: Invitation) {
// check(partyId, String);
// check(userId, String);
// let party = Parties.findOne(partyId);
// if (!party)
// throw new Meteor.Error('404', 'No such party!');
// if (party.public)
// throw new Meteor.Error('400', 'That party is public. No need to invite people.');
// if (party.owner !== this.userId)
// throw new Meteor.Error('403', 'No permissions!');
// Parties.update(partyId, {$addToSet: {invited: userId}});
let token = Random.hexString( 16 );
let message = {
subject: "Invitation",
text: `Hi, I just invited you to be an user in my brand new app!.
\n\nCome check it out: ${Meteor.absoluteUrl()}acceptinvitation/${token}\n`
};
Invitations.insert({
// company: ['', Validators.required],
company: user.company,
name: user.name,
last_name: user.last_name,
email: user.email,
role: user.role,
phone: user.phone,
address: user.address,
city: user.city,
state: user.state,
postal_code: user.postal_code,
token: token,
invitation_date: user.invitation_date,
message: message,
invited_by: Meteor.userId
});
let _from = "your@e.mail";
let to = user.email;
// console.log(to, Meteor.isServer, user, token);
if (Meteor.isServer && to) {
Email.send({
from: _from,
to: to,
replyTo: _from || undefined,
subject: message.subject,
text: message.text
});
// console.log(token);
}
},