mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package auth
 | |
| 
 | |
| import (
 | |
| 	"npm/internal/database"
 | |
| )
 | |
| 
 | |
| // GetByID finds a auth by ID
 | |
| func GetByID(id int) (Model, error) {
 | |
| 	var m Model
 | |
| 	err := m.LoadByID(id)
 | |
| 	return m, err
 | |
| }
 | |
| 
 | |
| // GetByUserIDType finds a user by email
 | |
| func GetByUserIDType(userID uint, authType string) (Model, error) {
 | |
| 	var auth Model
 | |
| 	db := database.GetDB()
 | |
| 	result := db.
 | |
| 		Where("user_id = ?", userID).
 | |
| 		Where("type = ?", authType).
 | |
| 		First(&auth)
 | |
| 	return auth, result.Error
 | |
| }
 |