Skip to content

Commit

Permalink
core: fix error when creating new user with default path
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Jan 9, 2025
1 parent 646d133 commit 5b923fd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions authentik/core/api/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def get_avatar(self, user: User) -> str:

def validate_path(self, path: str) -> str:
"""Validate path"""
if len(path) < 1:
return path
if path[:1] == "/" or path[-1] == "/":
raise ValidationError(_("No leading or trailing slashes allowed."))
for segment in path.split("/"):
Expand Down Expand Up @@ -239,6 +241,7 @@ class Meta:
]
extra_kwargs = {
"name": {"allow_blank": True},
"path": {"allow_blank": True},
}


Expand Down
2 changes: 0 additions & 2 deletions blueprints/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10241,7 +10241,6 @@
},
"path": {
"type": "string",
"minLength": 1,
"title": "Path"
},
"type": {
Expand Down Expand Up @@ -12620,7 +12619,6 @@
},
"path": {
"type": "string",
"minLength": 1,
"title": "Path"
},
"type": {
Expand Down
2 changes: 0 additions & 2 deletions schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51168,7 +51168,6 @@ components:
additionalProperties: {}
path:
type: string
minLength: 1
type:
$ref: '#/components/schemas/UserTypeEnum'
PatchedUserSAMLSourceConnectionRequest:
Expand Down Expand Up @@ -56547,7 +56546,6 @@ components:
additionalProperties: {}
path:
type: string
minLength: 1
type:
$ref: '#/components/schemas/UserTypeEnum'
required:
Expand Down
2 changes: 1 addition & 1 deletion web/src/admin/users/UserListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class UserListPage extends WithBrandConfig(WithCapabilitiesConfig(TablePa

constructor() {
super();
this.activePath = getURLParam<string>("path", "/");
this.activePath = getURLParam<string>("path", new DefaultUIConfig().defaults.userPath);
uiConfig().then((c) => {
if (c.defaults.userPath !== new DefaultUIConfig().defaults.userPath) {
this.activePath = c.defaults.userPath;
Expand Down

0 comments on commit 5b923fd

Please sign in to comment.