mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-29 11:44:21 +08:00 
			
		
		
		
	server: Fix CSRF on mobile reload (closes #318)
This commit is contained in:
		
							parent
							
								
									a9b094bf27
								
							
						
					
					
						commit
						07fb8c072d
					
				| @ -23,6 +23,11 @@ function index(req: Request, res: Response) { | |||||||
|     const csrfToken = req.csrfToken(); |     const csrfToken = req.csrfToken(); | ||||||
|     log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader('set-cookie')}`); |     log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader('set-cookie')}`); | ||||||
| 
 | 
 | ||||||
|  |     // We force the page to not be cached since on mobile the CSRF token can be
 | ||||||
|  |     // broken when closing the browser and coming back in to the page.
 | ||||||
|  |     // The page is restored from cache, but the API call fail.
 | ||||||
|  |     res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); | ||||||
|  | 
 | ||||||
|     res.render(view, { |     res.render(view, { | ||||||
|         csrfToken: csrfToken, |         csrfToken: csrfToken, | ||||||
|         themeCssUrl: getThemeCssUrl(options.theme), |         themeCssUrl: getThemeCssUrl(options.theme), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran