check if password and repeat match
This commit is contained in:
parent
b39198c935
commit
f65b3108ee
5 changed files with 62 additions and 6 deletions
|
@ -10,6 +10,7 @@
|
||||||
placeholder="neues Passwort"
|
placeholder="neues Passwort"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
class="rounded-b-none!"
|
class="rounded-b-none!"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -21,8 +22,10 @@
|
||||||
placeholder="neues Passwort wiederholen"
|
placeholder="neues Passwort wiederholen"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
class="rounded-t-none!"
|
class="rounded-t-none!"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<p v-if="notMatching">Passwörter stimmen nicht überein</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
|
@ -62,12 +65,22 @@ export default defineComponent({
|
||||||
verification: "loading" as "success" | "loading" | "failed",
|
verification: "loading" as "success" | "loading" | "failed",
|
||||||
changeStatus: undefined as undefined | "loading" | "success" | "failed",
|
changeStatus: undefined as undefined | "loading" | "success" | "failed",
|
||||||
changeError: "" as string,
|
changeError: "" as string,
|
||||||
|
notMatching: false as boolean,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
async change(e: any) {
|
async change(e: any) {
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
|
|
||||||
|
let new_pw = await hashString(formData.new.value);
|
||||||
|
let new_rep = await hashString(formData.new_rep.value);
|
||||||
|
if (new_pw != new_rep) {
|
||||||
|
this.notMatching = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.notMatching = false;
|
||||||
|
|
||||||
this.changeStatus = "loading";
|
this.changeStatus = "loading";
|
||||||
this.changeError = "";
|
this.changeError = "";
|
||||||
this.$http
|
this.$http
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
placeholder="neues Passwort"
|
placeholder="neues Passwort"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
class="rounded-none!"
|
class="rounded-none!"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -32,8 +33,10 @@
|
||||||
placeholder="neues Passwort wiederholen"
|
placeholder="neues Passwort wiederholen"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
class="rounded-t-none!"
|
class="rounded-t-none!"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<p v-if="notMatching">Passwörter stimmen nicht überein</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
|
@ -65,12 +68,22 @@ export default defineComponent({
|
||||||
verification: "loading" as "success" | "loading" | "failed",
|
verification: "loading" as "success" | "loading" | "failed",
|
||||||
changeStatus: undefined as undefined | "loading" | "success" | "failed",
|
changeStatus: undefined as undefined | "loading" | "success" | "failed",
|
||||||
changeError: "" as string,
|
changeError: "" as string,
|
||||||
|
notMatching: false as boolean,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
async change(e: any) {
|
async change(e: any) {
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
|
|
||||||
|
let new_pw = await hashString(formData.new.value);
|
||||||
|
let new_rep = await hashString(formData.new_rep.value);
|
||||||
|
if (new_pw != new_rep) {
|
||||||
|
this.notMatching = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.notMatching = false;
|
||||||
|
|
||||||
this.changeStatus = "loading";
|
this.changeStatus = "loading";
|
||||||
this.changeError = "";
|
this.changeError = "";
|
||||||
this.$http
|
this.$http
|
||||||
|
|
|
@ -56,16 +56,19 @@
|
||||||
placeholder="Passwort"
|
placeholder="Passwort"
|
||||||
class="rounded-b-none!"
|
class="rounded-b-none!"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
id="passwordrep"
|
id="password_rep"
|
||||||
name="passwordrep"
|
name="password_rep"
|
||||||
type="password"
|
type="password"
|
||||||
required
|
required
|
||||||
placeholder="Passwort wiederholen"
|
placeholder="Passwort wiederholen"
|
||||||
class="rounded-t-none!"
|
class="rounded-t-none!"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
|
<p v-if="notMatching">Passwörter stimmen nicht überein</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
|
@ -110,6 +113,7 @@ export default defineComponent({
|
||||||
username: "" as string,
|
username: "" as string,
|
||||||
inviteStatus: undefined as undefined | "loading" | "success" | "failed",
|
inviteStatus: undefined as undefined | "loading" | "success" | "failed",
|
||||||
inviteError: "" as string,
|
inviteError: "" as string,
|
||||||
|
notMatching: false as boolean,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -138,6 +142,8 @@ export default defineComponent({
|
||||||
if (this.tab == "totp") secret = this.totp(e);
|
if (this.tab == "totp") secret = this.totp(e);
|
||||||
else secret = await this.password(e);
|
else secret = await this.password(e);
|
||||||
|
|
||||||
|
if (secret == "") return;
|
||||||
|
|
||||||
this.inviteStatus = "loading";
|
this.inviteStatus = "loading";
|
||||||
this.inviteError = "";
|
this.inviteError = "";
|
||||||
this.$http
|
this.$http
|
||||||
|
@ -166,6 +172,15 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
async password(e: any) {
|
async password(e: any) {
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
|
|
||||||
|
let new_pw = await hashString(formData.password.value);
|
||||||
|
let new_rep = await hashString(formData.password_rep.value);
|
||||||
|
if (new_pw != new_rep) {
|
||||||
|
this.notMatching = true;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
this.notMatching = false;
|
||||||
|
|
||||||
return await hashString(formData.password.value);
|
return await hashString(formData.password.value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="max-w-md w-full space-y-8 pb-20">
|
<div class="max-w-md w-full space-y-8 pb-20">
|
||||||
<div class="flex flex-col items-center gap-4">
|
<div class="flex flex-col items-center gap-4">
|
||||||
<AppLogo />
|
<AppLogo />
|
||||||
<h2 class="text-center text-4xl font-extrabold text-gray-900">TOTP zurücksetzen</h2>
|
<h2 class="text-center text-4xl font-extrabold text-gray-900">Zugang zurücksetzen</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="verification == 'loading'" class="flex flex-col gap-2 items-center">
|
<div v-if="verification == 'loading'" class="flex flex-col gap-2 items-center">
|
||||||
|
@ -56,16 +56,19 @@
|
||||||
placeholder="Passwort"
|
placeholder="Passwort"
|
||||||
class="rounded-b-none!"
|
class="rounded-b-none!"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
id="passwordrep"
|
id="password_rep"
|
||||||
name="passwordrep"
|
name="password_rep"
|
||||||
type="password"
|
type="password"
|
||||||
required
|
required
|
||||||
placeholder="Passwort wiederholen"
|
placeholder="Passwort wiederholen"
|
||||||
class="rounded-t-none!"
|
class="rounded-t-none!"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
:class="notMatching ? 'border-red-600!' : ''"
|
||||||
/>
|
/>
|
||||||
|
<p v-if="notMatching">Passwörter stimmen nicht überein</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
|
@ -110,6 +113,7 @@ export default defineComponent({
|
||||||
otp: undefined as undefined | string,
|
otp: undefined as undefined | string,
|
||||||
resetStatus: undefined as undefined | "loading" | "success" | "failed",
|
resetStatus: undefined as undefined | "loading" | "success" | "failed",
|
||||||
resetError: "" as string,
|
resetError: "" as string,
|
||||||
|
notMatching: false as boolean,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -137,6 +141,8 @@ export default defineComponent({
|
||||||
if (this.tab == "totp") secret = this.totp(e);
|
if (this.tab == "totp") secret = this.totp(e);
|
||||||
else secret = await this.password(e);
|
else secret = await this.password(e);
|
||||||
|
|
||||||
|
if (secret == "") return;
|
||||||
|
|
||||||
this.resetStatus = "loading";
|
this.resetStatus = "loading";
|
||||||
this.resetError = "";
|
this.resetError = "";
|
||||||
this.$http
|
this.$http
|
||||||
|
@ -165,6 +171,15 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
async password(e: any) {
|
async password(e: any) {
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
|
|
||||||
|
let new_pw = await hashString(formData.password.value);
|
||||||
|
let new_rep = await hashString(formData.password_rep.value);
|
||||||
|
if (new_pw != new_rep) {
|
||||||
|
this.notMatching = true;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
this.notMatching = false;
|
||||||
|
|
||||||
return await hashString(formData.password.value);
|
return await hashString(formData.password.value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="max-w-md w-full space-y-8 pb-20">
|
<div class="max-w-md w-full space-y-8 pb-20">
|
||||||
<div class="flex flex-col items-center gap-4">
|
<div class="flex flex-col items-center gap-4">
|
||||||
<AppLogo />
|
<AppLogo />
|
||||||
<h2 class="text-center text-4xl font-extrabold text-gray-900">TOTP zurücksetzen</h2>
|
<h2 class="text-center text-4xl font-extrabold text-gray-900">Zugang zurücksetzen</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="flex flex-col gap-2" @submit.prevent="reset">
|
<form class="flex flex-col gap-2" @submit.prevent="reset">
|
||||||
|
|
Loading…
Add table
Reference in a new issue