fix: mtls for agent, problems with auth
This commit is contained in:
@@ -26,7 +26,12 @@ var ErrAccountInactive = errors.New("account is not activated")
|
||||
// Init creates the tokens table if it does not exist.
|
||||
func (r *Repository) Init() error {
|
||||
_, err := r.DB.Exec(storage.CreateSqlite)
|
||||
return err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Migration: add is_active column if it doesn't exist (SQLite ignores errors for duplicate column)
|
||||
_, _ = r.DB.Exec(storage.AddIsActiveColumn)
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateToken inserts a new user record with hashed password and generated token.
|
||||
@@ -46,7 +51,7 @@ func (r *Repository) CreateToken(tc TokenCreate) (string, error) {
|
||||
`INSERT INTO tokens (name, last_name, login, password, token, permission_view, permission_manage_agent, permission_admin, is_active)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
tc.Name, tc.LastName, tc.Login, string(hashed), token,
|
||||
tc.PermissionView, tc.PermissionManage, tc.PermissionAdmin, false,
|
||||
tc.PermissionView, tc.PermissionManage, tc.PermissionAdmin, tc.IsActive,
|
||||
)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user