Remove ADMIN_PASSWORD configuration
Authentication now works only via hashed passwords in imc_users table. Users must be created through the password reset flow or directly in the database.
This commit is contained in:
parent
3e30f3845d
commit
b76ea568ae
5 changed files with 7 additions and 97 deletions
|
|
@ -68,23 +68,6 @@ func (d *DB) DeleteImcUser(id uint) error {
|
|||
return d.Delete(&ImcUser{}, id).Error // Delete by primary key
|
||||
}
|
||||
|
||||
// EnsureAdminUser creates the admin user if it doesn't exist, or updates the password if it does.
|
||||
// This is used during --reset-admin-password and startup.
|
||||
// username: always "admin" in our case.
|
||||
// passwordHash: the bcrypt hash of the password.
|
||||
func (d *DB) EnsureAdminUser(username, passwordHash string) error {
|
||||
var user ImcUser
|
||||
// Try to find an existing admin user with this username.
|
||||
err := d.Where("username = ? AND role = ?", username, "admin").First(&user).Error
|
||||
if err == nil {
|
||||
// User exists - update their password.
|
||||
return d.Model(&ImcUser{}).Where("id = ?", user.ID).Update("password_hash", passwordHash).Error
|
||||
}
|
||||
// User doesn't exist - create them.
|
||||
_, err = d.CreateImcUser(username, passwordHash, "admin")
|
||||
return err
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Domain Access Control
|
||||
// These functions manage which domains users can access.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue