Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
c1bd8146
Commit
c1bd8146
authored
Dec 02, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments
parent
a6accf9b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Register.vue
frontend/src/views/Register.vue
+13
-3
No files found.
frontend/src/views/Register.vue
View file @
c1bd8146
...
@@ -46,21 +46,30 @@ export default {
...
@@ -46,21 +46,30 @@ export default {
this
.
showBackError
=
false
;
//TODO
this
.
showBackError
=
false
;
//TODO
},
},
onSubmit
:
async
function
(){
onSubmit
:
async
function
(){
// If we press back, we go back
if
(
event
.
submitter
.
id
==
'back'
)
{
this
.
$router
.
push
(
'/'
);
}
// Test if password match the confirm password
this
.
showPwdError
=
(
document
.
getElementById
(
'password1'
).
value
!==
document
.
getElementById
(
'password2'
).
value
);
this
.
showPwdError
=
(
document
.
getElementById
(
'password1'
).
value
!==
document
.
getElementById
(
'password2'
).
value
);
if
(
this
.
showPwdError
)
{
if
(
this
.
showPwdError
)
{
return
;
return
;
}
}
// Test if mail is valid
this
.
showMailError
=
!
validateEmail
(
document
.
getElementById
(
'mail'
).
value
);
this
.
showMailError
=
!
validateEmail
(
document
.
getElementById
(
'mail'
).
value
);
if
(
this
.
showMailError
)
{
if
(
this
.
showMailError
)
{
return
;
return
;
}
}
// Test if Email exist/Pseudo exist
this
.
showBackError
=
false
;
//TODO
this
.
showBackError
=
false
;
//TODO
if
(
this
.
showBackError
)
{
if
(
this
.
showBackError
)
{
return
;
return
;
}
}
if
(
event
.
submitter
.
id
==
'back'
)
{
this
.
$router
.
push
(
'/'
);
// Post new user if all tests are ok
}
if
(
event
.
submitter
.
id
==
'validate'
)
{
if
(
event
.
submitter
.
id
==
'validate'
)
{
let
request
=
await
fetch
(
'http://localhost/index.php/user'
,
let
request
=
await
fetch
(
'http://localhost/index.php/user'
,
{
{
...
@@ -86,6 +95,7 @@ export default {
...
@@ -86,6 +95,7 @@ export default {
}
}
}
}
}
}
// Function to check if the str email is valide (true if this is the case)
function
validateEmail
(
email
)
{
function
validateEmail
(
email
)
{
const
re
=
/^
[^\s
@
]
+@
[^\s
@
]
+
\.[^\s
@
]
+$/
;
const
re
=
/^
[^\s
@
]
+@
[^\s
@
]
+
\.[^\s
@
]
+$/
;
return
re
.
test
(
String
(
email
).
toLowerCase
());
return
re
.
test
(
String
(
email
).
toLowerCase
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment