Skip to content

Commit

Permalink
Fix root user creation error in tinode-db.
Browse files Browse the repository at this point in the history
  • Loading branch information
aforge authored and or-else committed Jul 2, 2023
1 parent 397b625 commit d975636
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tinode-db/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ func main() {
log.Fatalln("Failed to create ROOT user:", err)
}

adapter := store.Store.GetAdapter()
if err := adapter.AuthUpdRecord(user.Uid(), "basic", "", auth.LevelRoot, nil, time.Time{}); err != nil {
authHandler := store.Store.GetAuthHandler("basic")
if _, err := authHandler.AddRecord(&auth.Rec{Uid: user.Uid(), AuthLevel: auth.LevelRoot},
[]byte(uname+":"+password), ""); err != nil {
store.Users.Delete(user.Uid(), true)
log.Fatalln("Failed to create ROOT user:", err)
log.Fatalln("Failed to add ROOT auth record:", err)
}
log.Printf("ROOT user created: '%s:%s'", uname, password)
}
Expand Down

0 comments on commit d975636

Please sign in to comment.