finish up user management
This commit is contained in:
parent
74c1d40dae
commit
905d443c7d
|
@ -26,8 +26,7 @@ class CheckCreds(KnoxLoginView):
|
||||||
def post(self, request, format=None):
|
def post(self, request, format=None):
|
||||||
serializer = AuthTokenSerializer(data=request.data)
|
serializer = AuthTokenSerializer(data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
|
user = serializer.validated_data["user"]
|
||||||
user = get_object_or_404(User, username=request.data["username"])
|
|
||||||
|
|
||||||
if not user.totp_key:
|
if not user.totp_key:
|
||||||
return Response("totp not set")
|
return Response("totp not set")
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div style="width: 900px; max-width: 90vw;">
|
<div style="width: 900px; max-width: 90vw;">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-bar>
|
<q-bar>
|
||||||
<q-btn ref="refresh" @click="refresh" class="q-mr-sm" dense flat push icon="refresh" />Administration
|
<q-btn ref="refresh" @click="refresh" class="q-mr-sm" dense flat push icon="refresh" />User Administration
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn dense flat icon="close" v-close-popup>
|
<q-btn dense flat icon="close" v-close-popup>
|
||||||
<q-tooltip content-class="bg-white text-primary">Close</q-tooltip>
|
<q-tooltip content-class="bg-white text-primary">Close</q-tooltip>
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
</q-item>
|
</q-item>
|
||||||
<!-- admin manager -->
|
<!-- admin manager -->
|
||||||
<q-item clickable v-close-popup @click="showAdminManager = true">
|
<q-item clickable v-close-popup @click="showAdminManager = true">
|
||||||
<q-item-section>Administration</q-item-section>
|
<q-item-section>User Administration</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<!-- core settings -->
|
<!-- core settings -->
|
||||||
<q-item clickable v-close-popup @click="showEditCoreSettingsModal = true">
|
<q-item clickable v-close-popup @click="showEditCoreSettingsModal = true">
|
||||||
|
@ -170,7 +170,7 @@ export default {
|
||||||
AutomationManager,
|
AutomationManager,
|
||||||
InstallAgent,
|
InstallAgent,
|
||||||
UploadMesh,
|
UploadMesh,
|
||||||
AdminManager
|
AdminManager,
|
||||||
},
|
},
|
||||||
props: ["clients"],
|
props: ["clients"],
|
||||||
data() {
|
data() {
|
||||||
|
@ -184,7 +184,7 @@ export default {
|
||||||
showAutomationManager: false,
|
showAutomationManager: false,
|
||||||
showAdminManager: false,
|
showAdminManager: false,
|
||||||
showInstallAgent: false,
|
showInstallAgent: false,
|
||||||
showUploadMesh: false
|
showUploadMesh: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -200,7 +200,7 @@ export default {
|
||||||
},
|
},
|
||||||
edited() {
|
edited() {
|
||||||
this.$emit("edited");
|
this.$emit("edited");
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<q-card style="width: 60vw">
|
<q-card style="width: 60vw">
|
||||||
<q-form ref="form" @submit="submit">
|
<q-form ref="form" @submit="onSubmit">
|
||||||
<q-card-section class="row items-center">
|
<q-card-section class="row items-center">
|
||||||
<div class="text-h6">{{ title }}</div>
|
<div class="text-h6">{{ title }}</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
@ -113,9 +113,8 @@ export default {
|
||||||
this.last_name = r.data.last_name;
|
this.last_name = r.data.last_name;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit() {
|
onSubmit() {
|
||||||
this.$q.loading.show();
|
this.$q.loading.show();
|
||||||
|
|
||||||
let formData = {
|
let formData = {
|
||||||
id: this.pk,
|
id: this.pk,
|
||||||
username: this.username,
|
username: this.username,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<q-card style="width: 60vw">
|
<q-card style="width: 60vw">
|
||||||
<q-form ref="form" @submit="submit">
|
<q-form ref="form" @submit="onSubmit">
|
||||||
<q-card-section class="row items-center">
|
<q-card-section class="row items-center">
|
||||||
<div class="text-h6">{{ username }} Password Reset</div>
|
<div class="text-h6">{{ username }} Password Reset</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
@ -47,9 +47,8 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
onSubmit() {
|
||||||
this.$q.loading.show();
|
this.$q.loading.show();
|
||||||
|
|
||||||
let formData = {
|
let formData = {
|
||||||
id: this.pk,
|
id: this.pk,
|
||||||
password: this.password,
|
password: this.password,
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
credentials: {},
|
credentials: {},
|
||||||
prompt: false
|
prompt: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -80,9 +80,8 @@ export default {
|
||||||
.post("/checkcreds/", this.credentials)
|
.post("/checkcreds/", this.credentials)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if (r.data === "totp not set") {
|
if (r.data === "totp not set") {
|
||||||
this.$router.push({name: "TOTPSetup", params: { username: this.credentials.username }})
|
this.$router.push({ name: "TOTPSetup", params: { username: this.credentials.username } });
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.prompt = true;
|
this.prompt = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -102,11 +101,11 @@ export default {
|
||||||
this.credentials = {};
|
this.credentials = {};
|
||||||
this.prompt = false;
|
this.prompt = false;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$q.dark.set(true);
|
this.$q.dark.set(true);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue