rooms create use random password.

This commit is contained in:
Miroslav Šedivý
2021-11-17 19:13:50 +01:00
parent 40ca4962f5
commit 34dfdd53da
3 changed files with 22 additions and 8 deletions
+16 -6
View File
@@ -16,6 +16,8 @@
v-model="data.name"
:rules="[ rules.minLen(2), rules.containerNameStart, rules.containerName ]"
autocomplete="off"
:hint="!data.name && '... using random name'"
persistent-hint
></v-text-field>
</v-col>
<v-col class="pb-0">
@@ -28,26 +30,28 @@
</v-row>
<v-row align="center">
<v-col class="py-0">
<v-col>
<v-text-field
label="User password"
:rules="[ rules.required ]"
v-model="data.user_pass"
:append-icon="showUserPass ? 'mdi-eye' : 'mdi-eye-off'"
:type="showUserPass ? 'text' : 'password'"
@click:append="showUserPass = !showUserPass"
autocomplete="off"
:hint="!data.user_pass && '... using random password'"
persistent-hint
></v-text-field>
</v-col>
<v-col class="py-0">
<v-col>
<v-text-field
label="Admin password"
:rules="[ rules.required ]"
v-model="data.admin_pass"
:append-icon="showAdminPass ? 'mdi-eye' : 'mdi-eye-off'"
:type="showAdminPass ? 'text' : 'password'"
@click:append="showAdminPass = !showAdminPass"
autocomplete="off"
:hint="!data.admin_pass && '... using random password'"
persistent-hint
></v-text-field>
</v-col>
</v-row>
@@ -82,6 +86,7 @@
<v-row align="center" no-gutters>
<v-text-field
:disabled="!maxFpsEnabled"
:rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
label="Max frames per second"
v-model="data.video_max_fps"
></v-text-field>
@@ -111,7 +116,7 @@
<v-text-field
label="Video bitrate"
type="number"
:rules="[ rules.nonZero, rules.onlyPositive ]"
:rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
v-model="data.video_bitrate"
></v-text-field>
</v-col>
@@ -128,7 +133,7 @@
<v-text-field
label="Audio bitrate"
type="number"
:rules="[ rules.nonZero, rules.onlyPositive ]"
:rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
v-model="data.audio_bitrate"
></v-text-field>
</v-col>
@@ -350,6 +355,7 @@
<script lang="ts">
import { Vue, Component, Ref, Watch } from 'vue-property-decorator'
import { randomPassword } from '@/utils/random'
import {
RoomSettings,
@@ -512,6 +518,10 @@ export default class RoomsCreate extends Vue {
await this.$store.dispatch('ROOMS_CREATE', {
...this.data,
// eslint-disable-next-line
user_pass: this.data.user_pass || randomPassword(),
// eslint-disable-next-line
admin_pass: this.data.admin_pass || randomPassword(),
// eslint-disable-next-line
max_connections: Number(this.data.max_connections),
// eslint-disable-next-line
video_bitrate: Number(this.data.video_bitrate),
+3 -2
View File
@@ -47,6 +47,7 @@
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import RoomInfo from '@/components/RoomInfo.vue'
import { randomPassword } from '@/utils/random'
@Component({
components: {
@@ -72,9 +73,9 @@ export default class RoomActionBtn extends Vue {
// eslint-disable-next-line
neko_image,
// eslint-disable-next-line
user_pass: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
user_pass: randomPassword(),
// eslint-disable-next-line
admin_pass: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
admin_pass: randomPassword(),
})
this.roomId = entry.id
+3
View File
@@ -0,0 +1,3 @@
export function randomPassword() {
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
}