Skip to content

Commit 930f9f6

Browse files
authored
fix(ssologin): missing role in SSO auto-registration and minor callback issue (#9305)
* fix(ssologin): return after error response * fix(ssologin): set default role for SSO user creation
1 parent 2310748 commit 930f9f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/handles/ssologin.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/base64"
55
"errors"
66
"fmt"
7+
"github.com/alist-org/alist/v3/internal/op"
78
"net/http"
89
"net/url"
910
"path"
@@ -154,7 +155,7 @@ func autoRegister(username, userID string, err error) (*model.User, error) {
154155
Password: random.String(16),
155156
Permission: int32(setting.GetInt(conf.SSODefaultPermission, 0)),
156157
BasePath: setting.GetStr(conf.SSODefaultDir),
157-
Role: nil,
158+
Role: model.Roles{op.GetDefaultRoleID()},
158159
Disabled: false,
159160
SsoID: userID,
160161
}
@@ -256,6 +257,7 @@ func OIDCLoginCallback(c *gin.Context) {
256257
user, err = autoRegister(userID, userID, err)
257258
if err != nil {
258259
common.ErrorResp(c, err, 400)
260+
return
259261
}
260262
}
261263
token, err := common.GenerateToken(user)

0 commit comments

Comments
 (0)