Add account APIs.

This commit is contained in:
Yang Luo
2021-02-11 22:56:08 +08:00
parent 09ffe69382
commit 3ea58a0cdc
7 changed files with 263 additions and 0 deletions

View File

@ -60,6 +60,15 @@ func GetUser(id string) *User {
return getUser(owner, name)
}
func HasUser(id string) bool {
return GetUser(id) != nil
}
func IsPasswordCorrect(userId string, password string) bool {
user := GetUser(userId)
return user.Password == password
}
func UpdateUser(id string, user *User) bool {
owner, name := util.GetOwnerAndNameFromId(id)
if getUser(owner, name) == nil {