Helper functions for the migration scripts
This commit is contained in:
parent
fd0b9cf53d
commit
b62b303995
2 changed files with 7 additions and 3 deletions
|
@ -36,11 +36,15 @@ func (db *pgDB) AddUser(name string, pass string) error {
|
|||
log.Error("Error hashing password: ", err)
|
||||
return errors.New("An error happen storing the password")
|
||||
}
|
||||
return db.AddRawUser(name, hpass, salt, "")
|
||||
}
|
||||
|
||||
func (db *DB) AddRawUser(name string, hpass []byte, salt []byte, role string) error {
|
||||
u := user{
|
||||
Username: name,
|
||||
Password: hpass,
|
||||
Salt: salt,
|
||||
Role: "",
|
||||
Role: role,
|
||||
}
|
||||
return db.sql.Create(&u)
|
||||
}
|
||||
|
|
Reference in a new issue