Adds type and endpoint for username validation.
identity is not simple_endpoint anymore.
This commit is contained in:
parent
7d6d50d66d
commit
8525a363e0
|
@ -54,6 +54,7 @@ from subiquity.common.types import (
|
|||
TimeZoneInfo,
|
||||
UbuntuProInfo,
|
||||
UbuntuProCheckTokenAnswer,
|
||||
UsernameValidation,
|
||||
WLANSupportInstallState,
|
||||
ZdevInfo,
|
||||
WSLConfigurationBase,
|
||||
|
@ -64,7 +65,6 @@ from subiquity.common.types import (
|
|||
@api
|
||||
class API:
|
||||
"""The API offered by the subiquity installer process."""
|
||||
identity = simple_endpoint(IdentityData)
|
||||
locale = simple_endpoint(str)
|
||||
proxy = simple_endpoint(str)
|
||||
ssh = simple_endpoint(SSHData)
|
||||
|
@ -334,6 +334,11 @@ class API:
|
|||
class check_token:
|
||||
def GET(token: Payload[str]) \
|
||||
-> UbuntuProCheckTokenAnswer: ...
|
||||
class identity:
|
||||
def GET() -> IdentityData: ...
|
||||
def POST(data: Payload[IdentityData]): ...
|
||||
class validate:
|
||||
def GET(username: str) ->UsernameValidation: ...
|
||||
|
||||
|
||||
class LinkAction(enum.Enum):
|
||||
|
|
|
@ -354,6 +354,13 @@ class IdentityData:
|
|||
crypted_password: str = attr.ib(default='', repr=False)
|
||||
hostname: str = ''
|
||||
|
||||
class UsernameValidation(enum.Enum):
|
||||
OK = enum.auto()
|
||||
ALREADY_IN_USE = enum.auto()
|
||||
SYSTEM_RESERVED = enum.auto()
|
||||
INVALID_CHARS = enum.auto()
|
||||
TOO_LONG = enum.auto()
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class SSHData:
|
||||
|
|
Loading…
Reference in New Issue