mirror of https://github.com/Xhofe/alist
				
				
				
			fix(session): Fixed the session status update logic. (#9296)
- Removed the error returned when the session status is `SessionInactive`. - Updated the `LastActive` field of the session to always record the current time.pull/9299/head
							parent
							
								
									de09ba08b6
								
							
						
					
					
						commit
						3bf0af1e68
					
				|  | @ -25,11 +25,9 @@ func Handle(userID uint, deviceKey, ua, ip string) error { | ||||||
| 	now := time.Now().Unix() | 	now := time.Now().Unix() | ||||||
| 	sess, err := db.GetSession(userID, deviceKey) | 	sess, err := db.GetSession(userID, deviceKey) | ||||||
| 	if err == nil { | 	if err == nil { | ||||||
| 		if sess.Status == model.SessionInactive { | 		// reactivate existing session if it was inactive
 | ||||||
| 			return errors.WithStack(errs.SessionInactive) |  | ||||||
| 		} |  | ||||||
| 		sess.LastActive = now |  | ||||||
| 		sess.Status = model.SessionActive | 		sess.Status = model.SessionActive | ||||||
|  | 		sess.LastActive = now | ||||||
| 		sess.UserAgent = ua | 		sess.UserAgent = ua | ||||||
| 		sess.IP = ip | 		sess.IP = ip | ||||||
| 		return db.UpsertSession(sess) | 		return db.UpsertSession(sess) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 千石
						千石