本文整理匯總了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);
}
},