OAuth: fix duplicate devices
This commit is contained in:
parent
dca1a7b8e3
commit
daa26bf726
1 changed files with 5 additions and 5 deletions
|
|
@ -106,7 +106,7 @@ func NewOauth(ctx context.Context, name, device string, oc *oauth2.Config, opts
|
|||
|
||||
// reuse instance
|
||||
if instance := getInstance(subject); instance != nil {
|
||||
if device != "" {
|
||||
if device != "" && !slices.Contains(instance.devices, device) {
|
||||
instance.devices = append(instance.devices, device)
|
||||
}
|
||||
return instance, nil
|
||||
|
|
@ -126,14 +126,14 @@ func NewOauth(ctx context.Context, name, device string, oc *oauth2.Config, opts
|
|||
name: name,
|
||||
}
|
||||
|
||||
if device != "" && !slices.Contains(o.devices, device) {
|
||||
o.devices = append(o.devices, device)
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(o)
|
||||
}
|
||||
|
||||
if device != "" {
|
||||
o.devices = []string{device}
|
||||
}
|
||||
|
||||
// load token from db
|
||||
var token oauth2.Token
|
||||
if settings.Exists(o.subject) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue