本文整理汇总了Golang中github.com/JacobXie/leanote/app/info.User.Pwd方法的典型用法代码示例。如果您正苦于以下问题:Golang User.Pwd方法的具体用法?Golang User.Pwd怎么用?Golang User.Pwd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/JacobXie/leanote/app/info.User
的用法示例。
在下文中一共展示了User.Pwd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Init
//.........这里部分代码省略.........
Albums = Session.DB(dbname).C("albums")
Files = Session.DB(dbname).C("files")
Attachs = Session.DB(dbname).C("attachs")
NoteImages = Session.DB(dbname).C("note_images")
Configs = Session.DB(dbname).C("configs")
EmailLogs = Session.DB(dbname).C("email_logs")
// 社交
BlogLikes = Session.DB(dbname).C("blog_likes")
BlogComments = Session.DB(dbname).C("blog_comments")
// 举报
Reports = Session.DB(dbname).C("reports")
// session
Sessions = Session.DB(dbname).C("sessions")
//Modified by JacobXie
//系统初始化,即初始化管理员和一些基本数据
countNum, err := Users.Count()
if err != nil {
panic(err)
}
if countNum == 0 {
//初始化管理员,admin,密码 admin123
user := info.User{}
user.UserId = bson.NewObjectId()
user.Email = "[email protected]"
user.Verified = true
user.Username = "admin"
user.UsernameRaw = "admin"
user.Pwd = GenPwd("admin123")
user.CreatedTime = time.Now()
user.Theme = "simple"
user.NotebookWidth = 160
user.NoteListWidth = 266
Insert(Users, user)
blog_single := info.BlogSingle{}
blog_single.SingleId = bson.NewObjectId()
blog_single.UserId = user.UserId
blog_single.Title = "About Me"
blog_single.UrlTitle = "About-Me"
blog_single.Content = "<p>Hello, I am Leanote (^_^).</p>"
blog_single.CreatedTime = time.Now()
blog_single.UpdatedTime = blog_single.CreatedTime
Insert(BlogSingles, blog_single)
//Insert(Configs,& info.Config{ConfigId:bson.NewObjectId(), UserId:user.UserId, Key:"openRegister", ValueStr:"open" })
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "toImageBinPath", ValueStr: "lllllllllll"})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "noteSubDomain", ValueStr: ""})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "blogSubDomain", ValueStr: ""})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "leaSubDomain", ValueStr: ""})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "recommendTags", ValueArr: []string{"小写", "golang", "leanote"}, IsArr: true})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "newTags", ValueArr: []string{"小写", "golang", "leanote", "haha"}, IsArr: true})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailHost", ValueStr: "smtp.163.com"})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailPort", ValueStr: "25"})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailUsername", ValueStr: ""})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailPassword", ValueStr: ""})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailTemplateHeader", ValueStr: "<div style=\"width: 600px; margin:auto; border-radius:5px; border: 1px solid #ccc; padding: 20px;\">\r\n\t\t\t<div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<div style=\"float:left; height: 40px;\">\r\n\t\t\t\t\t\t<a href=\"{{$.siteUrl}}\" style=\"font-size: 24px\">leanote</a>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"float:left; height:40px; line-height:40px;\">\r\n\t\t\t\t\t\t | <span style=\"font-size:14px\">{{$.subject}}</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"clear:both\"></div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<hr style=\"border:none;border-top: 1px solid #ccc\"/>\r\n\t\t\t<div style=\"margin-top: 20px; font-size: 14px;\">\r\n\t\t\t\t"})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailTemplateFooter", ValueStr: "</div>\r\n\r\n\t\t\t<div id=\"leanoteFooter\" style=\"margin-top: 30px; border-top: 1px solid #ccc\">\r\n\t\t\t\t<style>\r\n\t\t\t\t\t#leanoteFooter {\r\n\t\t\t\t\t\tcolor: #666;\r\n\t\t\t\t\t\tfont-size: 12px;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t#leanoteFooter a {\r\n\t\t\t\t\t\tcolor: #666;\r\n\t\t\t\t\t\tfont-size: 12px;\r\n\t\t\t\t\t}\r\n\t\t\t\t</style>\r\n\t\t\t\t<a href=\"{{$.siteUrl}}\">leanote</a>, your own cloud note!\r\n\t\t\t</div>\r\n\t\t</div>"})
Insert(Configs, &info.Config{ConfigId: bson.NewObjectId(), UserId: user.UserId, Key: "emailTemplateRegisterSubject", ValueStr: "欢迎来到leanote, 请验证邮箱"})