diff --git a/models/user/user.go b/models/user/user.go index 825223201..a2c54a442 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -1233,7 +1233,10 @@ func GetUserByOpenID(uri string) (*User, error) { // GetAdminUser returns the first administrator func GetAdminUser() (*User, error) { var admin User - has, err := db.GetEngine(db.DefaultContext).Where("is_admin=?", true).Get(&admin) + has, err := db.GetEngine(db.DefaultContext). + Where("is_admin=?", true). + Asc("id"). // Reliably get the admin with the lowest ID. + Get(&admin) if err != nil { return nil, err } else if !has {