Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
book racker
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
Container 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
THARUNIKA V S
book racker
Commits
39ff8c06
Commit
39ff8c06
authored
4 years ago
by
V S Tharunika
Browse files
Options
Downloads
Patches
Plain Diff
added token to register function
parent
2f047a37
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/src/controllers/AuthenticationController.js
+17
-14
17 additions, 14 deletions
server/src/controllers/AuthenticationController.js
server/src/models/user.js
+7
-7
7 additions, 7 deletions
server/src/models/user.js
with
24 additions
and
21 deletions
server/src/controllers/AuthenticationController.js
+
17
−
14
View file @
39ff8c06
...
...
@@ -14,13 +14,16 @@ module.exports={
try
{
const
user
=
await
User
.
create
(
req
.
body
)
res
.
send
(
user
.
toJSON
())
const
userJson
=
user
.
toJSON
()
res
.
send
({
user
:
userJSON
,
token
:
jwtSignUser
(
userJson
)
})
}
catch
(
err
){
res
.
status
(
400
).
send
({
error
:
'
This email account is already in use.
'
})
}
},
async
login
(
req
,
res
)
{
try
{
...
...
This diff is collapsed.
Click to expand it.
server/src/models/user.js
+
7
−
7
View file @
39ff8c06
const
Promise
=
require
(
'
bluebird
'
)
const
bcrypt
=
Promise
.
promisif
i
yAll
(
require
(
'
bcrypt-nodejs
'
))
const
bcrypt
=
Promise
.
promisifyAll
(
require
(
'
bcrypt-nodejs
'
))
function
hashPassword
(
user
,
options
)
{
const
SALT_FACTOR
=
8
...
...
@@ -17,7 +17,7 @@ function hashPassword (user, options) {
}
module
.
exports
=
(
sequelize
,
DataTypes
)
=>
{
const
User
=
sequelize
.
define
(
'
u
ser
'
,{
const
User
=
sequelize
.
define
(
'
U
ser
'
,
{
email
:
{
type
:
DataTypes
.
STRING
,
unique
:
true
...
...
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