|
|
@@ -576,6 +576,7 @@ func isUsableName(names, patterns []string, name string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// IsUsableUsername returns an error when a username is reserved
|
|
|
func IsUsableUsername(name string) error {
|
|
|
return isUsableName(reservedUsernames, reservedUserPatterns, name)
|
|
|
}
|
|
|
@@ -665,7 +666,7 @@ func parseUserFromCode(code string) (user *User) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// verify active code when active account
|
|
|
+// VerifyUserActiveCode verify active code when active account
|
|
|
func VerifyUserActiveCode(code string) (user *User) {
|
|
|
minutes := setting.Service.ActiveCodeLives
|
|
|
|
|
|
@@ -681,7 +682,7 @@ func VerifyUserActiveCode(code string) (user *User) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// verify active code when active account
|
|
|
+// VerifyActiveEmailCode verify active code when active account
|
|
|
func VerifyActiveEmailCode(code, email string) *EmailAddress {
|
|
|
minutes := setting.Service.ActiveCodeLives
|
|
|
|
|
|
@@ -910,6 +911,7 @@ func UserPath(userName string) string {
|
|
|
return filepath.Join(setting.RepoRootPath, strings.ToLower(userName))
|
|
|
}
|
|
|
|
|
|
+// GetUserByKeyID get user information by user's public key id
|
|
|
func GetUserByKeyID(keyID int64) (*User, error) {
|
|
|
user := new(User)
|
|
|
has, err := x.SQL("SELECT a.* FROM `user` AS a, public_key AS b WHERE a.id = b.owner_id AND b.id=?", keyID).Get(user)
|
|
|
@@ -1113,6 +1115,7 @@ type Follow struct {
|
|
|
FollowID int64 `xorm:"UNIQUE(follow)"`
|
|
|
}
|
|
|
|
|
|
+// IsFollowing returns true if user is following followID.
|
|
|
func IsFollowing(userID, followID int64) bool {
|
|
|
has, _ := x.Get(&Follow{UserID: userID, FollowID: followID})
|
|
|
return has
|