MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / createRootAccountIfNeed

Function createRootAccountIfNeed

model/main.go:67–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65var LOG_DB *gorm.DB
66
67func createRootAccountIfNeed() error {
68 var user User
69 //if user.Status != common.UserStatusEnabled {
70 if err := DB.First(&user).Error; err != nil {
71 common.SysLog("no user exists, create a root user for you: username is root, password is 123456")
72 hashedPassword, err := common.Password2Hash("123456")
73 if err != nil {
74 return err
75 }
76 rootUser := User{
77 Username: "root",
78 Password: hashedPassword,
79 Role: common.RoleRootUser,
80 Status: common.UserStatusEnabled,
81 DisplayName: "Root User",
82 AccessToken: nil,
83 Quota: 100000000,
84 }
85 DB.Create(&rootUser)
86 }
87 return nil
88}
89
90func CheckSetup() {
91 setup := GetSetup()

Callers

nothing calls this directly

Calls 2

SysLogFunction · 0.92
Password2HashFunction · 0.92

Tested by

no test coverage detected