Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corps-directory
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
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
fhurtado14
corps-directory
Commits
c3edd0d9
Commit
c3edd0d9
authored
5 months ago
by
Federico Hurtado
Browse files
Options
Downloads
Patches
Plain Diff
Redirect to homepage rather than sending JSON response in backend.
parent
bec7680b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/.env
+2
-0
2 additions, 0 deletions
backend/.env
backend/config/auth/auth.login.js
+3
-5
3 additions, 5 deletions
backend/config/auth/auth.login.js
with
5 additions
and
5 deletions
backend/.env
+
2
−
0
View file @
c3edd0d9
...
...
@@ -4,3 +4,5 @@ DB_USER=corps_directory_dev
DB_PASSWORD=corps_db_password
DB_NAME=corps_directory_db
PORT=3000
FRONTEND_URL=localhost:8080
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/config/auth/auth.login.js
+
3
−
5
View file @
c3edd0d9
...
...
@@ -42,11 +42,9 @@ const casLogin = function (req, res, next) {
// sign the token with secret key
const
token
=
jwt
.
sign
(
payload
,
JWT_SECRET
,
{
expiresIn
:
"
1h
"
});
// send the token to the frontend.
res
.
status
(
200
).
json
({
message
:
"
successfully authenticated.
"
,
token
:
"
token
"
,
});
// Send the JWT token to the frontend
console
.
log
(
"
sending JWT To:
"
,
process
.
env
.
FRONTEND_URL
);
res
.
redirect
(
`
${
process
.
env
.
FRONTEND_URL
}
/practice?token=
${
token
}
`
);
console
.
log
(
"
Successfully authenticated and generated token.
"
);
});
...
...
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