本文整理汇总了TypeScript中lib/tylogger.LogDB函数的典型用法代码示例。如果您正苦于以下问题:TypeScript LogDB函数的具体用法?TypeScript LogDB怎么用?TypeScript LogDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogDB函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: changeEmail
export function changeEmail(uid, mail){
try{
if(!mail || !validateEmail(mail)){
//throw new Error("无效邮件地址.");
return "无效邮件地址!"
}
let user = Meteor.users.findOne({_id: uid})
var oldmail = _.find(user.emails || [],
function (e) { return e.address; });
let address = (oldmail || {}).address;
LogDebug(address, mail)
if(address && address == mail){
return 'mail is unchanged'
}
if(address){
Accounts.removeEmail(uid, address)
}
Accounts.addEmail(uid, mail)
return 'ok'
}catch(err){
LogDB(err.toString(), 'changeEmail()', uid)
return err.toString()
}
}
开发者ID:maiernte,项目名称:projectmix,代码行数:27,代码来源:email.ts
示例2: function
upsertRecord: function(record: YiRecord){
try{
BkRecords.upsert(record)
}catch(err){
LogDB(err.toString(), record, this.userId)
}
}
开发者ID:maiernte,项目名称:projectmix,代码行数:7,代码来源:main.ts
示例3: sendResetPasswordEmail
export function sendResetPasswordEmail (userId, email) {
try{
// Make sure the user exists, and email is one of their addresses.
var user = Meteor.users.findOne(userId);
if (!user)
throw new Error("Can't find user");
// pick the first email if we weren't passed an email.
if (!email && user.emails && user.emails[0])
email = user.emails[0].address;
// make sure we have a valid email
if (!email || !_.contains(_.pluck(user.emails || [], 'address'), email))
throw new Error("No such email for user.");
var tokenRecord = {
token: RandomStr(44),
email: email,
when: new Date()
};
Meteor.users.update(userId, {$set: {
"services.password.reset": tokenRecord
}});
// before passing to template, update user object with new token
Meteor._ensure(user, 'services', 'password').reset = tokenRecord;
var mailbody = writeResetPasswordEmail(email, tokenRecord.token, user.username)
return mailbody;
}catch(err){
LogDB(err.toString(), 'sendResetPasswordEmail()', userId)
return err.toString()
}
};
开发者ID:maiernte,项目名称:projectmix,代码行数:35,代码来源:email.ts
示例4: function
Meteor.publish('bkrecord', function(bookid: string, options: Object) {
try{
return BkRecords.find(buildQuery.call(this, bookid), options);
}catch(err){
LogDB(err.toString(), options, 'publish: ' + bookid)
return null
}
});
开发者ID:maiernte,项目名称:projectmix,代码行数:8,代码来源:bookcollection.ts
示例5: validateEmail
function validateEmail(email) {
try{
var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
//var re = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
return re.test(email);
}catch(err){
LogDB(err.toString(), 'validateEmail()', this.userId)
return false
}
}
开发者ID:maiernte,项目名称:projectmix,代码行数:10,代码来源:email.ts
示例6: verificationMail
export function verificationMail(uid, address): Object{
try{
// Make sure the user exists, and address is one of their addresses.
var user = Meteor.users.findOne({_id: uid});
if (!user){
//throw new Error("Can't find user");
LogDebug('Cannot find user')
return null
}
// pick the first unverified address if we weren't passed an address.
if (!address) {
var email = _.find(user.emails || [],
function (e) { return !e.verified; });
address = (email || {}).address;
}
// make sure we have a valid address
if (!address || !_.contains(_.pluck(user.emails || [], 'address'), address)){
//throw new Error("No such email address for user.");
LogDebug('no email')
return null
}
var tokenRecord = {
token: RandomStr(44),
address: address,
when: new Date()
};
Meteor.users.update({_id: uid}, {$push: {'services.email.verificationTokens': tokenRecord}});
// before passing to template, update user object with new token
Meteor._ensure(user, 'services', 'email');
if (!user.services.email.verificationTokens) {
user.services.email.verificationTokens = [];
}
user.services.email.verificationTokens.push(tokenRecord);
//var verifyEmailUrl = Accounts.urls.verifyEmail(tokenRecord.token);
var mailbody = writeVerifyEmail(address, tokenRecord.token, user.username)
return mailbody;
}catch(err){
LogDB(err.toString(), 'verificationMail()', uid)
return null
}
}
开发者ID:maiernte,项目名称:projectmix,代码行数:51,代码来源:email.ts
注:本文中的lib/tylogger.LogDB函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论