Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
idatt2106_2024_02_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 - Gruppe 2
idatt2106_2024_02_frontend
Commits
30366869
Commit
30366869
authored
10 months ago
by
Malin Haugland Høli
Browse files
Options
Downloads
Patches
Plain Diff
fix:
Add confirmation when email is sent or fails to send
parent
5031abc5
No related branches found
Branches containing commit
No related tags found
3 merge requests
!66
Final merge
,
!38
Confirmation when email is sent
,
!4
Pipeline fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/FormLogin.vue
+46
-28
46 additions, 28 deletions
src/components/FormLogin.vue
with
46 additions
and
28 deletions
src/components/FormLogin.vue
+
46
−
28
View file @
30366869
...
...
@@ -15,6 +15,8 @@ const emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\
const
userStore
=
useUserStore
()
const
isEmailValid
=
computed
(()
=>
emailRegex
.
test
(
resetEmail
.
value
))
const
isSendingEmail
=
ref
(
false
);
const
successMessage
=
ref
<
string
>
(
''
);
const
submitForm
=
()
=>
{
userStore
.
login
(
username
.
value
,
password
.
value
)
...
...
@@ -30,12 +32,20 @@ const openForgotPasswordModal = (event: MouseEvent) => {
}
const
submitReset
=
async
()
=>
{
await
axios
.
post
(
'
http://localhost:8080/forgotPassword/changePasswordRequest
'
,
{
email
:
resetEmail
.
value
})
resetEmail
.
value
=
''
isModalOpen
.
value
=
false
isSendingEmail
.
value
=
true
;
try
{
await
axios
.
post
(
'
http://localhost:8080/forgotPassword/changePasswordRequest
'
,
{
email
:
resetEmail
.
value
});
successMessage
.
value
=
'
E-posten er sendt. Vennligst sjekk innboksen din for instrukser. OBS: E-posten kan havne i spam-mappen
'
;
resetEmail
.
value
=
''
;
}
catch
(
error
)
{
console
.
error
(
error
);
errorMessage
.
value
=
'
Noe gikk galt. Vennligst prøv igjen.
'
;
}
finally
{
isSendingEmail
.
value
=
false
;
isModalOpen
.
value
=
false
;
}
}
const
closeModal
=
()
=>
{
...
...
@@ -51,6 +61,7 @@ watch(
)
</
script
>
<
template
>
<div
class=
"flex flex-col justify-center gap-5 w-full"
>
<div
class=
"flex flex-col"
>
...
...
@@ -101,30 +112,37 @@ watch(
:title=
"'Glemt passord'"
:message=
"'Vennligst skriv inn e-posten din for å endre passordet.'"
:is-modal-open=
"isModalOpen"
@
close=
"
isModalOpen = false
"
@
close=
"
closeModal
"
>
<template
v-slot:input
>
<input
type=
"email"
v-model=
"resetEmail"
class=
"border border-gray-300 p-2 w-full mb-7"
placeholder=
"Skriv e-postadressen din her"
/>
</
template
>
<
template
v-slot:buttons
>
<button
:disabled=
"!isEmailValid"
@
click=
"submitReset"
class=
"active-button font-bold py-2 px-4 w-1/2 border-2 disabled:border-transparent"
>
Send mail
</button>
<button
@
click=
"closeModal"
class=
"active-button font-bold py-2 px-4 w-1/2 border-2 disabled:border-transparent"
>
Lukk
</button>
<div
v-if=
"isSendingEmail"
class=
"flex justify-center items-center"
>
<div
class=
"p-3 animate-spin drop-shadow-2xl bg-gradient-to-r from-lime-500 from-30% to-green-600 to-90% md:w-18 md:h-20 h-20 w-20 aspect-square rounded-full"
>
<div
class=
"rounded-full h-full w-full bg-slate-100 dark:bg-zinc-900 background-blur-md"
></div>
</div>
</div>
<div
v-else
>
<input
type=
"email"
v-model=
"resetEmail"
class=
"border border-gray-300 p-2 w-full mb-7"
placeholder=
"Skriv e-postadressen din her"
/>
<div
class=
"flex gap-5 mt-4"
>
<button
:disabled=
"!isEmailValid"
@
click=
"submitReset"
class=
"active-button font-bold py-2 px-4 w-1/2 border-2 disabled:border-transparent"
>
Send mail
</button>
<button
@
click=
"closeModal"
class=
"active-button font-bold py-2 px-4 w-1/2 border-2 disabled:border-transparent"
>
Lukk
</button>
</div>
</div>
</
template
>
</modal-component>
</template>
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