Login verification working.
This commit is contained in:
parent
d87307a370
commit
64e6548bda
@ -72,9 +72,9 @@ let allowCrossDomain = function(req, res, next) {
|
||||
port: 5432,
|
||||
})
|
||||
|
||||
const PREFIX="/ngsplanner"
|
||||
|
||||
const ENDPOINTDATA=[
|
||||
const PREFIX="/ngsplanner"
|
||||
|
||||
const ENDPOINTDATA=[
|
||||
{
|
||||
endpoint:"class",
|
||||
requiredfields:["name"],
|
||||
@ -788,6 +788,21 @@ app.get(PREFIX+'/test/dataid',async(req,res)=>{
|
||||
res.status(200).json(finalresult)
|
||||
})
|
||||
|
||||
app.post(PREFIX+"/validUser",(req,res)=>{
|
||||
console.log(process.env.SALT)
|
||||
db.query('select * from users where username=$1 and password_hash=$2 limit 1',[req.body.username,req.body.password])
|
||||
.then((data)=>{
|
||||
if (data.rows.length>0) {
|
||||
res.status(200).json({verified:true})
|
||||
} else {
|
||||
res.status(200).json({verified:false})
|
||||
}
|
||||
})
|
||||
.catch((err)=>{
|
||||
res.status(500).send(err.message)
|
||||
})
|
||||
})
|
||||
|
||||
//Generates our table schema:
|
||||
ENDPOINTDATA.forEach((endpoint)=>{
|
||||
console.log(endpoint.endpoint+":\n\t"+endpoint.requiredfields.join('\t')+(endpoint.optionalfields.length>0?"\t":"")+endpoint.optionalfields.join("\t"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user