Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
simcaq
simcaq-node
Commits
d9d76c59
There was a problem fetching the pipeline summary.
Commit
d9d76c59
authored
7 years ago
by
Lucas Gabriel Lima
Browse files
Options
Downloads
Patches
Plain Diff
sends array of error messages, if any
parent
f043dace
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!116
Release v1.0.0
,
!52
fix error message on user signup when there are multiple errors
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/user.js
+9
-9
9 additions, 9 deletions
src/libs/routes/user.js
with
9 additions
and
9 deletions
src/libs/routes/user.js
+
9
−
9
View file @
d9d76c59
...
...
@@ -23,7 +23,7 @@ function emailSyntax(email) {
userApp
.
post
(
'
/
'
,
(
req
,
res
,
next
)
=>
{
if
(
req
.
body
.
email
){
if
(
!
emailSyntax
(
req
.
body
.
email
)){
res
.
json
({
success
:
false
,
msg
:
'
O email informado é inválido.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O email informado é inválido.
'
]
});
}
else
{
next
();
}
...
...
@@ -35,10 +35,10 @@ userApp.post('/', (req, res, next) => {
User
.
count
({
'
email
'
:
req
.
body
.
email
},
function
(
err
,
count
){
if
(
err
){
log
.
error
(
'
MongoDB error:
'
+
err
);
res
.
json
({
success
:
false
,
msg
:
'
Um erro ocorreu no banco de dados.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
Um erro ocorreu no banco de dados.
'
]
});
}
if
(
count
){
res
.
json
({
success
:
false
,
msg
:
'
O email informado já está cadastrado.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O email informado já está cadastrado.
'
]
});
}
else
{
next
();
}
...
...
@@ -48,10 +48,10 @@ userApp.post('/', (req, res, next) => {
User
.
count
({
'
cpf
'
:
req
.
body
.
cpf
},
function
(
err
,
count
){
if
(
err
){
log
.
error
(
'
MongoDB error:
'
+
err
);
res
.
json
({
success
:
false
,
msg
:
'
Um erro ocorreu no banco de dados.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
Um erro ocorreu no banco de dados.
'
]
});
}
if
(
count
){
res
.
json
({
success
:
false
,
msg
:
'
O CPF informado já está cadastrado.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O CPF informado já está cadastrado.
'
]
});
}
else
{
next
();
}
...
...
@@ -92,14 +92,14 @@ userApp.post('/', (req, res, next) => {
userApp
.
post
(
'
/authenticate
'
,
(
req
,
res
,
next
)
=>
{
if
(
!
req
.
body
.
email
)
{
res
.
json
({
success
:
false
,
msg
:
'
O campo Email é obrigatório.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O campo Email é obrigatório.
'
]
});
}
else
{
next
();
}
},
(
req
,
res
,
next
)
=>
{
if
(
!
req
.
body
.
password
)
{
res
.
json
({
success
:
false
,
msg
:
'
O campo Senha é obrigatório.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O campo Senha é obrigatório.
'
]
});
}
else
{
next
();
}
...
...
@@ -111,7 +111,7 @@ userApp.post('/authenticate', (req, res, next) => {
if
(
err
)
throw
err
;
if
(
!
user
){
res
.
json
({
success
:
false
,
msg
:
'
O Email informado não está cadastrado.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
O Email informado não está cadastrado.
'
]
});
}
else
{
user
.
comparePassword
(
req
.
body
.
password
,
(
err
,
isMatch
)
=>
{
...
...
@@ -125,7 +125,7 @@ userApp.post('/authenticate', (req, res, next) => {
res
.
json
({
success
:
true
,
token
:
'
JWT
'
+
token
,
msg
:
'
Usuário autenticado com sucesso
'
});
}
else
{
res
.
json
({
success
:
false
,
msg
:
'
A Senha informada é inválida.
'
});
res
.
json
({
success
:
false
,
msg
:
[
'
A Senha informada é inválida.
'
]
});
}
});
}
...
...
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