本文整理汇总了Golang中github.com/leanote/leanote/app/info.User类的典型用法代码示例。如果您正苦于以下问题:Golang User类的具体用法?Golang User怎么用?Golang User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setUserLogo
func (this *UserService) setUserLogo(user *info.User) {
// Logo路径问题, 有些有http: 有些没有
if user.Logo == "" {
user.Logo = "images/blog/default_avatar.png"
}
if user.Logo != "" && !strings.HasPrefix(user.Logo, "http") {
user.Logo = strings.Trim(user.Logo, "/")
user.Logo = configService.GetSiteUrl() + "/" + user.Logo
}
}
开发者ID:rainkong,项目名称:leanote,代码行数:10,代码来源:UserService.go
示例2: Register
// 1. 添加用户
// 2. 将leanote共享给我
// [ok]
func (this *AuthService) Register(email, pwd, fromUserId string) (bool, string) {
// 用户是否已存在
if userService.IsExistsUser(email) {
return false, "userHasBeenRegistered-" + email
}
user := info.User{UserId: bson.NewObjectId(), Email: email, Username: email, Pwd: Md5(pwd)}
if fromUserId != "" && IsObjectId(fromUserId) {
user.FromUserId = bson.ObjectIdHex(fromUserId)
}
LogJ(user)
return this.register(user)
}
开发者ID:intZz,项目名称:leanote,代码行数:15,代码来源:AuthService.go
示例3: Register
// 1. 添加用户
// 2. 将leanote共享给我
// [ok]
func (this *AuthService) Register(email, pwd, fromUserId string) (bool, string) {
// 用户是否已存在
if userService.IsExistsUser(email) {
return false, "userHasBeenRegistered-" + email
}
passwd := GenPwd(pwd)
if passwd == "" {
return false, "GenerateHash error"
}
user := info.User{UserId: bson.NewObjectId(), Email: email, Username: email, Pwd: passwd}
if fromUserId != "" && IsObjectId(fromUserId) {
user.FromUserId = bson.ObjectIdHex(fromUserId)
}
return this.register(user)
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:18,代码来源:AuthService.go
示例4: AddUser
// 添加用户
func (this *UserService) AddUser(user info.User) bool {
if user.UserId == "" {
user.UserId = bson.NewObjectId()
}
user.CreatedTime = time.Now()
if user.Email != "" {
user.Email = strings.ToLower(user.Email)
// 发送验证邮箱
go func() {
this.RegisterSendActiveEmail(user.UserId.Hex(), user.Email)
}()
}
return db.Insert(db.Users, user)
}
开发者ID:hello-kukoo,项目名称:leanote,代码行数:18,代码来源:UserService.go
示例5: AddUser
// 添加用户
func (this *UserService) AddUser(user info.User) bool {
if user.UserId == "" {
user.UserId = bson.NewObjectId()
}
user.CreatedTime = time.Now()
if user.Email != "" {
user.Email = strings.ToLower(user.Email)
// 发送验证邮箱
go func() {
emailService.RegisterSendActiveEmail(user, user.Email)
// 发送给我 [email protected]
emailService.SendEmail("[email protected]", "新增用户", "{header}用户名"+user.Email+"{footer}")
}()
}
return db.Insert(db.Users, user)
}
开发者ID:rainkong,项目名称:leanote,代码行数:20,代码来源:UserService.go
示例6: GetUserInfo
// 得到用户信息
func (c BaseController) GetUserInfo() info.User {
if userId, ok := c.Session["UserId"]; ok && userId != "" {
notebookWidth, _ := strconv.Atoi(c.Session["NotebookWidth"])
noteListWidth, _ := strconv.Atoi(c.Session["NoteListWidth"])
user := info.User{UserId: bson.ObjectIdHex(userId),
Email: c.Session["Email"],
Username: c.Session["Username"],
UsernameRaw: c.Session["UsernameRaw"],
Theme: c.Session["Theme"],
NotebookWidth: notebookWidth,
NoteListWidth: noteListWidth,
}
if c.Session["Verified"] == "1" {
user.Verified = true
}
if c.Session["LeftIsMin"] == "1" {
user.LeftIsMin = true
}
return user
}
return info.User{}
}
开发者ID:bigxing,项目名称:leanote,代码行数:23,代码来源:BaseController.go
示例7: setRenderUserInfo
// 可以不要, 因为注册的时候已经把username设为email了
func (c Blog) setRenderUserInfo(userInfo info.User) {
if userInfo.Username == "" {
userInfo.Username = userInfo.Email
}
c.RenderArgs["userInfo"] = userInfo
}
开发者ID:intZz,项目名称:leanote,代码行数:7,代码来源:BlogController.go
注:本文中的github.com/leanote/leanote/app/info.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论