mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-31 05:24:13 +00:00 
			
		
		
		
	Update signin.ts
This commit is contained in:
		
							parent
							
								
									bdef33e88d
								
							
						
					
					
						commit
						f257853906
					
				
					 1 changed files with 14 additions and 12 deletions
				
			
		|  | @ -4,6 +4,8 @@ import config from '../../../config'; | ||||||
| import { ILocalUser } from '../../../models/user'; | import { ILocalUser } from '../../../models/user'; | ||||||
| 
 | 
 | ||||||
| export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { | export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { | ||||||
|  | 	if (redirect) { | ||||||
|  | 		//#region Cookie
 | ||||||
| 		const expires = 1000 * 60 * 60 * 24 * 365; // One Year
 | 		const expires = 1000 * 60 * 60 * 24 * 365; // One Year
 | ||||||
| 		ctx.cookies.set('i', user.token, { | 		ctx.cookies.set('i', user.token, { | ||||||
| 			path: '/', | 			path: '/', | ||||||
|  | @ -15,8 +17,8 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) { | ||||||
| 			expires: new Date(Date.now() + expires), | 			expires: new Date(Date.now() + expires), | ||||||
| 			maxAge: expires | 			maxAge: expires | ||||||
| 		}); | 		}); | ||||||
|  | 		//#endregion
 | ||||||
| 
 | 
 | ||||||
| 	if (redirect) { |  | ||||||
| 		ctx.redirect(config.url); | 		ctx.redirect(config.url); | ||||||
| 	} else { | 	} else { | ||||||
| 		ctx.status = 204; | 		ctx.status = 204; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue