Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
frontend
Commits
cab31c1b
Commit
cab31c1b
authored
11 months ago
by
Anders Høvik
Browse files
Options
Downloads
Patches
Plain Diff
adjusted form for BaseInput
parent
684263c2
No related branches found
No related tags found
1 merge request
!30
Feature/update user settings layout
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/UpdateUserComponents/UpdateUserLayout.vue
+44
-26
44 additions, 26 deletions
src/components/UpdateUserComponents/UpdateUserLayout.vue
with
44 additions
and
26 deletions
src/components/UpdateUserComponents/UpdateUserLayout.vue
+
44
−
26
View file @
cab31c1b
...
...
@@ -8,6 +8,7 @@ const emailRef = ref('')
const
passwordRef
=
ref
(
''
)
const
confirmPasswordRef
=
ref
(
''
)
const
formRef
=
ref
()
let
samePasswords
=
ref
(
true
)
const
handleFirstNameInputEvent
=
(
newValue
:
any
)
=>
{
firstNameRef
.
value
=
newValue
...
...
@@ -30,18 +31,27 @@ const handleConfirmPasswordInputEvent = (newValue: any) => {
confirmPasswordRef
.
value
=
newValue
}
const
handleSubmit
=
()
=>
{
const
handleSubmit
=
async
()
=>
{
console
.
log
(
firstNameRef
.
value
)
samePasswords
.
value
=
(
passwordRef
.
value
===
confirmPasswordRef
.
value
)
console
.
log
(
samePasswords
.
value
)
const
form
=
formRef
.
value
;
// Check if the form is valid
if
(
form
.
checkValidity
())
{
// Form is valid, submit the form or perform other actions
console
.
log
(
'
Form is valid
'
);
}
else
{
console
.
log
(
'
Form is not valid
'
);
}
formRef
.
value
.
classList
.
add
(
"
was-validated
"
)
}
</
script
>
<
template
>
...
...
@@ -49,76 +59,84 @@ const handleSubmit = () => {
<!-- The userprofile and the form that will update name, email, password -->
<div
class=
"row"
>
<div
class=
"col-md-2 text-center"
>
<img
src=
"/src/assets/userprofile.png"
class=
"img-fluid"
>
<img
src=
"/src/assets/userprofile.png"
class=
"img-fluid"
alt=
"userprofile"
>
<p
class=
"h2"
>
Username
</p>
</div>
<div
class=
"col-md-10"
>
<form
class=
"needs-validation"
novalidate
>
<form
@
submit.prevent=
"handleSubmit"
>
<div
class=
"row"
>
<div
class=
"form-group col-md-6"
>
<!--
<label
for=
"inputFirstName"
class=
"form-label"
>
First Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputFirstName"
placeholder=
"ex: Brian"
>
-->
<BaseInput
:model-value=
"firstNameRef.value"
@
input-change-event=
"handleFirstNameInputEvent"
@
input-change-event=
"handleFirstNameInputEvent"
ref=
"firstNameRef"
id=
"firstNameInput"
id=
"firstNameInput
-change
"
input-id=
"first-name"
type=
"text"
label=
"First name"
placeholder=
"Enter your first name"
/>
<label
for=
"inputFirstName"
class=
"form-label"
>
First Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputFirstName"
placeholder=
"ex: Brian"
>
placeholder=
"Enter your first name"
invalid-message=
"Please enter your first name"
/>
</div>
<div
class=
"form-group col-md-6"
>
<!--
<label
for=
"inputPassword4"
>
Last Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputLastName"
placeholder=
"ex: Cox"
>
-->
<BaseInput
:model-value=
"surnameRef.value"
@
input-change-event=
"handleSurnameInputEvent"
ref=
"surnameRef"
id=
"surnameInput"
id=
"surnameInput
-change
"
input-id=
"surname"
type=
"text"
label=
"Surname"
placeholder=
"Enter your surname"
/>
<label
for=
"inputPassword4"
>
Last Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputLastName"
placeholder=
"ex: Cox"
>
placeholder=
"Enter your surname"
invalid-message=
"Please enter your surname"
/>
</div>
</div>
<div
class=
"form-group col-md-6"
>
<!--
<label
for=
"inputAddress"
>
Email
</label>
<input
type=
"email"
class=
"form-control"
id=
"inputMail"
placeholder=
"ex: briancox@mail.com"
>
-->
<BaseInput
:model-value=
"emailRef.value"
@
input-change-event=
"handleEmailInputEvent"
ref=
"emailRef"
id=
"emailInput"
id=
"emailInput
-change
"
input-id=
"email"
type=
"email"
label=
"Email"
placeholder=
"Enter your email"
/>
<label
for=
"inputAddress"
>
Email
</label>
<input
type=
"email"
class=
"form-control"
id=
"inputMail"
placeholder=
"ex: briancox@mail.com"
>
placeholder=
"Enter your email"
invalid-message=
"Invalid email"
/>
</div>
<div
class=
"row"
>
<div
class=
"form-group col-md-6"
>
<!--
<label
for=
"inputPassword"
>
Password
</label>
<input
type=
"password"
class=
"form-control"
id=
"inputPassword"
placeholder=
"Password with capital letter, number and a special character"
>
-->
<BaseInput
:model-value=
"passwordRef.value"
@
input-change-event=
"handlePasswordInputEvent"
ref=
"passwordRef"
id=
"passwordInput"
id=
"passwordInput
-change
"
input-id=
"password"
type=
"password"
pattern=
"(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).
{4,16}"
label="Password"
placeholder=
"Enter password"
/>
<label
for=
"inputEmail4"
>
Password
</label>
<input
type=
"password"
class=
"form-control"
id=
"inputPassword"
placeholder=
"Password with capital letter, number and a special character"
>
placeholder="Enter password"
invalid-message="Password must be between 4 and 16 characters and contain one capital letter, small letter and a number"/>
</div>
<div
class=
"form-group col-md-6"
>
<BaseInput
:model-value=
"confirmPasswordRef.value"
<!--
<label
for=
"inputPasswordConfirmed"
>
Confirmed Password
</label>
<input
type=
"password"
class=
"form-control"
id=
"inputPasswordConfirmed"
placeholder=
"Repeat password"
>
-->
<BaseInput
:modelValue=
"confirmPasswordRef.value"
@
input-change-event=
"handleConfirmPasswordInputEvent"
ref=
"confirmPasswordRef"
id=
"confirmPasswordInput"
id=
"confirmPasswordInput
-change
"
input-id=
"confirmPassword"
type=
"password"
pattern=
"(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).
{4,16}"
label="Confirm Password"
placeholder=
"Confirm password"
/>
<label
for=
"inputPassword4"
>
Confirmed Password
</label
>
<
input
type=
"p
assword"
class=
"
form-control"
id=
"inputPasswordConfirmed"
placeholder=
"Repeat password"
>
placeholder="Confirm password"
invalid-message="Password must be between 4 and 16 characters and contain one capital letter, small letter and a number"/
>
<
p
v-if=
"sameP
assword
s
"
class=
"
text-danger"
>
The passwords are not identical
</p
>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
Change settings
</button>
<button
type=
"submit"
@
click=
"handleSubmit"
class=
"btn btn-primary"
>
Change settings
</button>
</form>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment