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" v-model="data.name"
:rules="[ rules.minLen(2), rules.containerNameStart, rules.containerName ]" :rules="[ rules.minLen(2), rules.containerNameStart, rules.containerName ]"
autocomplete="off" autocomplete="off"
:hint="!data.name && '... using random name'"
persistent-hint
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col class="pb-0"> <v-col class="pb-0">
@@ -28,26 +30,28 @@
</v-row> </v-row>
<v-row align="center"> <v-row align="center">
<v-col class="py-0"> <v-col>
<v-text-field <v-text-field
label="User password" label="User password"
:rules="[ rules.required ]"
v-model="data.user_pass" v-model="data.user_pass"
:append-icon="showUserPass ? 'mdi-eye' : 'mdi-eye-off'" :append-icon="showUserPass ? 'mdi-eye' : 'mdi-eye-off'"
:type="showUserPass ? 'text' : 'password'" :type="showUserPass ? 'text' : 'password'"
@click:append="showUserPass = !showUserPass" @click:append="showUserPass = !showUserPass"
autocomplete="off" autocomplete="off"
:hint="!data.user_pass && '... using random password'"
persistent-hint
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col class="py-0"> <v-col>
<v-text-field <v-text-field
label="Admin password" label="Admin password"
:rules="[ rules.required ]"
v-model="data.admin_pass" v-model="data.admin_pass"
:append-icon="showAdminPass ? 'mdi-eye' : 'mdi-eye-off'" :append-icon="showAdminPass ? 'mdi-eye' : 'mdi-eye-off'"
:type="showAdminPass ? 'text' : 'password'" :type="showAdminPass ? 'text' : 'password'"
@click:append="showAdminPass = !showAdminPass" @click:append="showAdminPass = !showAdminPass"
autocomplete="off" autocomplete="off"
:hint="!data.admin_pass && '... using random password'"
persistent-hint
></v-text-field> ></v-text-field>
</v-col> </v-col>
</v-row> </v-row>
@@ -82,6 +86,7 @@
<v-row align="center" no-gutters> <v-row align="center" no-gutters>
<v-text-field <v-text-field
:disabled="!maxFpsEnabled" :disabled="!maxFpsEnabled"
:rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
label="Max frames per second" label="Max frames per second"
v-model="data.video_max_fps" v-model="data.video_max_fps"
></v-text-field> ></v-text-field>
@@ -111,7 +116,7 @@
<v-text-field <v-text-field
label="Video bitrate" label="Video bitrate"
type="number" type="number"
:rules="[ rules.nonZero, rules.onlyPositive ]" :rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
v-model="data.video_bitrate" v-model="data.video_bitrate"
></v-text-field> ></v-text-field>
</v-col> </v-col>
@@ -128,7 +133,7 @@
<v-text-field <v-text-field
label="Audio bitrate" label="Audio bitrate"
type="number" type="number"
:rules="[ rules.nonZero, rules.onlyPositive ]" :rules="[ rules.required, rules.nonZero, rules.onlyPositive ]"
v-model="data.audio_bitrate" v-model="data.audio_bitrate"
></v-text-field> ></v-text-field>
</v-col> </v-col>
@@ -350,6 +355,7 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component, Ref, Watch } from 'vue-property-decorator' import { Vue, Component, Ref, Watch } from 'vue-property-decorator'
import { randomPassword } from '@/utils/random'
import { import {
RoomSettings, RoomSettings,
@@ -512,6 +518,10 @@ export default class RoomsCreate extends Vue {
await this.$store.dispatch('ROOMS_CREATE', { await this.$store.dispatch('ROOMS_CREATE', {
...this.data, ...this.data,
// eslint-disable-next-line // 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), max_connections: Number(this.data.max_connections),
// eslint-disable-next-line // eslint-disable-next-line
video_bitrate: Number(this.data.video_bitrate), video_bitrate: Number(this.data.video_bitrate),
+3 -2
View File
@@ -47,6 +47,7 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component } from 'vue-property-decorator' import { Vue, Component } from 'vue-property-decorator'
import RoomInfo from '@/components/RoomInfo.vue' import RoomInfo from '@/components/RoomInfo.vue'
import { randomPassword } from '@/utils/random'
@Component({ @Component({
components: { components: {
@@ -72,9 +73,9 @@ export default class RoomActionBtn extends Vue {
// eslint-disable-next-line // eslint-disable-next-line
neko_image, neko_image,
// eslint-disable-next-line // 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 // 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 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)
}