當前位置: 首頁>>代碼示例>>Golang>>正文


Golang info.User類代碼示例

本文整理匯總了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;未經允許,請勿轉載。