OIDC: Retrieve promotion from OIDC claims
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
87b6975383
commit
a48bc1f1bc
4 changed files with 43 additions and 16 deletions
6
users.go
6
users.go
|
@ -207,14 +207,14 @@ func userExists(login string) bool {
|
|||
return err == nil && z == 1
|
||||
}
|
||||
|
||||
func NewUser(login string, email string, firstname string, lastname string, groups string) (*User, error) {
|
||||
func NewUser(login string, email string, firstname string, lastname string, promo uint, groups string) (*User, error) {
|
||||
t := time.Now()
|
||||
if res, err := DBExec("INSERT INTO users (login, email, firstname, lastname, time, promo, groups) VALUES (?, ?, ?, ?, ?, ?, ?)", login, email, firstname, lastname, t, currentPromo, groups); err != nil {
|
||||
if res, err := DBExec("INSERT INTO users (login, email, firstname, lastname, time, promo, groups) VALUES (?, ?, ?, ?, ?, ?, ?)", login, email, firstname, lastname, t, promo, groups); err != nil {
|
||||
return nil, err
|
||||
} else if sid, err := res.LastInsertId(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return &User{sid, login, email, firstname, lastname, t, currentPromo, groups, false}, nil
|
||||
return &User{sid, login, email, firstname, lastname, t, promo, groups, false}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue