set device name from hostname
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
38e7a7fe59
commit
ad5ccf8062
|
@ -44,6 +44,7 @@ class MobileDeviceInfoSerializer(PassiveSerializer):
|
||||||
)
|
)
|
||||||
os_version = CharField()
|
os_version = CharField()
|
||||||
model = CharField()
|
model = CharField()
|
||||||
|
hostname = CharField()
|
||||||
app_version = CharField()
|
app_version = CharField()
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ class MobileDeviceViewSet(
|
||||||
device: MobileDevice = self.get_object()
|
device: MobileDevice = self.get_object()
|
||||||
data = MobileDeviceEnrollmentSerializer(data=request.data)
|
data = MobileDeviceEnrollmentSerializer(data=request.data)
|
||||||
data.is_valid(raise_exception=True)
|
data.is_valid(raise_exception=True)
|
||||||
|
device.name = data.validated_data["info"].validated_data["hostname"]
|
||||||
device.confirmed = True
|
device.confirmed = True
|
||||||
device.device_id = data.validated_data["device_uid"]
|
device.device_id = data.validated_data["device_uid"]
|
||||||
device.save()
|
device.save()
|
||||||
|
|
|
@ -35307,11 +35307,15 @@ components:
|
||||||
model:
|
model:
|
||||||
type: string
|
type: string
|
||||||
minLength: 1
|
minLength: 1
|
||||||
|
hostname:
|
||||||
|
type: string
|
||||||
|
minLength: 1
|
||||||
app_version:
|
app_version:
|
||||||
type: string
|
type: string
|
||||||
minLength: 1
|
minLength: 1
|
||||||
required:
|
required:
|
||||||
- app_version
|
- app_version
|
||||||
|
- hostname
|
||||||
- model
|
- model
|
||||||
- os_version
|
- os_version
|
||||||
- platform
|
- platform
|
||||||
|
|
Reference in New Issue