()
| 65 | var LOG_DB *gorm.DB |
| 66 | |
| 67 | func 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 | |
| 90 | func CheckSetup() { |
| 91 | setup := GetSetup() |
nothing calls this directly
no test coverage detected