allow auth tokens in get requests
This commit is contained in:
		
							parent
							
								
									e252f8e504
								
							
						
					
					
						commit
						87cd9c590f
					
				| @ -11,6 +11,13 @@ export const setup = function (router, con, server) { | |||||||
|         res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
 |         res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
 | ||||||
|         let unsigned; |         let unsigned; | ||||||
|         if (req.body.user == undefined || req.body.pass == undefined) { |         if (req.body.user == undefined || req.body.pass == undefined) { | ||||||
|  |             if(typeof req.get("ipost-auth-token") === "string") { | ||||||
|  |                 try{ | ||||||
|  |                     req.body.auth = JSON.parse(req.get("ipost-auth-token")) | ||||||
|  |                 } catch(err) { | ||||||
|  |                     console.log("error parsing header",err) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             if(req.body.auth != undefined) { |             if(req.body.auth != undefined) { | ||||||
|                 if(typeof req.body.auth === "string") { |                 if(typeof req.body.auth === "string") { | ||||||
|                     try{ |                     try{ | ||||||
| @ -18,7 +25,7 @@ export const setup = function (router, con, server) { | |||||||
|                     } catch(err) { |                     } catch(err) { | ||||||
|                         console.log("error parsing",err) |                         console.log("error parsing",err) | ||||||
|                     } |                     } | ||||||
|                 } |                 } else  | ||||||
|                 if( |                 if( | ||||||
|                     typeof req.body.auth            !== "object" ||  |                     typeof req.body.auth            !== "object" ||  | ||||||
|                     typeof req.body.auth.secret     !== "string" ||  |                     typeof req.body.auth.secret     !== "string" ||  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user