Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2019_TP2
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
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
nicolas.paschoud
2019_TP2
Commits
9ce35bd6
Commit
9ce35bd6
authored
5 years ago
by
noe.fleury
Browse files
Options
Downloads
Patches
Plain Diff
Corrected things
parent
14092968
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
projet/hyperdrive-rest.js
+4
-3
4 additions, 3 deletions
projet/hyperdrive-rest.js
projet/node_modules/crypto-js/package.json
+0
-2
0 additions, 2 deletions
projet/node_modules/crypto-js/package.json
with
4 additions
and
5 deletions
projet/hyperdrive-rest.js
+
4
−
3
View file @
9ce35bd6
...
@@ -37,10 +37,11 @@ function Payload(user, pass_enc){
...
@@ -37,10 +37,11 @@ function Payload(user, pass_enc){
this
.
pass_enc
=
pass_enc
;
this
.
pass_enc
=
pass_enc
;
this
.
toString
=
function
(){
return
"
{
"
+
this
.
user
+
"
,
"
+
this
.
pass_enc
+
"
}
"
};
this
.
toString
=
function
(){
return
"
{
"
+
this
.
user
+
"
,
"
+
this
.
pass_enc
+
"
}
"
};
}
}
function
Signature
(
token
){
function
Signature
(
token
){
const
secret
=
"
our super hyperdrive secret
"
;
const
secret
=
"
our super hyperdrive secret
"
+
new
Date
()
;
return
CryptoJS
.
HmacSHA512
(
token
,
secret
);
return
CryptoJS
.
HmacSHA512
(
token
,
secret
);
}
}
...
@@ -95,11 +96,11 @@ app.get('/', (req, res) => {
...
@@ -95,11 +96,11 @@ app.get('/', (req, res) => {
// resCode : [ 0: User now logged in, 1: False password, 2: Invalid username, 3: Empty user or pass ]
// resCode : [ 0: User now logged in, 1: False password, 2: Invalid username, 3: Empty user or pass ]
app
.
get
(
'
/login
'
,
(
req
,
res
)
=>
{
app
.
get
(
'
/login
'
,
(
req
,
res
)
=>
{
sql
.
connect
();
//
sql.connect();
const
user
=
req
.
query
[
'
user
'
];
const
user
=
req
.
query
[
'
user
'
];
const
pass
=
req
.
query
[
'
pass
'
];
const
pass
=
req
.
query
[
'
pass
'
];
userObject
=
sql
.
userExist
(
user
,
pass
);
//
userObject = sql.userExist(user, pass);
if
(
!
user
||
!
pass
)
{
if
(
!
user
||
!
pass
)
{
res
.
send
({
res
.
send
({
...
...
This diff is collapsed.
Click to expand it.
projet/node_modules/crypto-js/package.json
+
0
−
2
View file @
9ce35bd6
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
[
[
"crypto-js@3.1.9-1"
,
"crypto-js@3.1.9-1"
,
"/Users/nono/Documents/HEPIA/3ème année/WEB avancé/git/2019_tp2/projet"
"/Users/nono/Documents/HEPIA/3ème année/WEB avancé/git/2019_tp2/projet"
//
"/Users/klaus/Documents/Web/Back/2019_tp2/projet"
]
]
],
],
"_from"
:
"crypto-js@3.1.9-1"
,
"_from"
:
"crypto-js@3.1.9-1"
,
...
@@ -28,7 +27,6 @@
...
@@ -28,7 +27,6 @@
"_resolved"
:
"https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz"
,
"_resolved"
:
"https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz"
,
"_spec"
:
"3.1.9-1"
,
"_spec"
:
"3.1.9-1"
,
"_where"
:
"/Users/nono/Documents/HEPIA/3ème année/WEB avancé/git/2019_tp2/projet"
,
"_where"
:
"/Users/nono/Documents/HEPIA/3ème année/WEB avancé/git/2019_tp2/projet"
,
//
"_where"
:
"/Users/klaus/Documents/Web/Back/2019_tp2/projet"
,
"author"
:
{
"author"
:
{
"name"
:
"Evan Vosberg"
,
"name"
:
"Evan Vosberg"
,
"url"
:
"http://github.com/evanvosberg"
"url"
:
"http://github.com/evanvosberg"
...
...
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