Skip to content
Snippets Groups Projects
Commit 23967999 authored by Trygve Jørgensen's avatar Trygve Jørgensen
Browse files

fix: register regex updated

parent b1c5eb76
No related branches found
No related tags found
3 merge requests!66Final merge,!31Updated input validation,!4Pipeline fix
...@@ -15,10 +15,11 @@ const errorMessage = ref<string>('') ...@@ -15,10 +15,11 @@ const errorMessage = ref<string>('')
const userStore = useUserStore() const userStore = useUserStore()
const nameRegex = /^[a-zA-Z ,.'-]+$/ const nameRegex = /^[æÆøØåÅa-zA-Z,.'-][æÆøØåÅa-zA-Z ,.'-]{1,29}$/
const emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/ const emailRegex =
const usernameRegex = /^[A-Za-z][A-Za-z0-9_]{2,29}$/ /^[æÆøØåÅa-zA-Z0-9_+&*-]+(?:\.[æÆøØåÅa-zA-Z0-9_+&*-]+)*@(?:[æÆøØåÅa-zA-Z0-9-]+\.)+[æÆøØåÅa-zA-Z]{2,7}$/
const passwordRegex = /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=!])(?=\S+$).{8,}$/ const usernameRegex = /^[ÆØÅæøåA-Za-z][æÆøØåÅA-Za-z0-9_]{2,29}$/
const passwordRegex = /^(?=.*[0-9])(?=.*[a-zæøå])(?=.*[ÆØÅA-Z])(?=.*[@#$%^&+=!])(?=\S+$).{8,30}$/
const isFirstNameValid = computed(() => nameRegex.test(firstname.value) && firstname.value) const isFirstNameValid = computed(() => nameRegex.test(firstname.value) && firstname.value)
const isLastNameValid = computed(() => nameRegex.test(lastname.value) && lastname.value) const isLastNameValid = computed(() => nameRegex.test(lastname.value) && lastname.value)
...@@ -55,7 +56,7 @@ watch( ...@@ -55,7 +56,7 @@ watch(
<div class="flex flex-row justify-between mx-4"> <div class="flex flex-row justify-between mx-4">
<p>Fornavn*</p> <p>Fornavn*</p>
<ToolTip <ToolTip
:message="'Must include only letters, spaces, commas, apostrophes, periods, and hyphens.'" :message="'Must include only letters, spaces, commas, apostrophes, periods, and hyphens. 1-30 characters long'"
/> />
</div> </div>
<input <input
...@@ -70,7 +71,7 @@ watch( ...@@ -70,7 +71,7 @@ watch(
<div class="flex flex-row justify-between mx-4"> <div class="flex flex-row justify-between mx-4">
<p>Etternavn*</p> <p>Etternavn*</p>
<ToolTip <ToolTip
:message="'Must include only letters, spaces, commas, apostrophes, periods, and hyphens.'" :message="'Must include only letters, spaces, commas, apostrophes, periods, and hyphens. 1-30 characters long'"
/> />
</div> </div>
<input <input
...@@ -85,7 +86,7 @@ watch( ...@@ -85,7 +86,7 @@ watch(
<div class="flex flex-row justify-between mx-4"> <div class="flex flex-row justify-between mx-4">
<p>E-post*</p> <p>E-post*</p>
<ToolTip <ToolTip
:message="'Must include a valid format with \'@\' and a domain, only letters, numbers, and special characters (_ + & * -) allowed.'" :message="'Valid email: Starts with Norwegian letters, numbers, or special characters. Includes \@\ followed by a domain. Ends with 2-7 letters.'"
/> />
</div> </div>
<input <input
...@@ -100,7 +101,7 @@ watch( ...@@ -100,7 +101,7 @@ watch(
<div class="flex flex-row justify-between mx-4"> <div class="flex flex-row justify-between mx-4">
<p>Brukernavn*</p> <p>Brukernavn*</p>
<ToolTip <ToolTip
:message="'Must start with a letter and can include numbers and underscores, 3-30 characters long.'" :message="'Must start with a letter and can include numbers and underscores. 3-30 characters long.'"
/> />
</div> </div>
<input <input
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment