mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-11-04 08:05:42 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			v3.3.0
			...
			v3.3.1-bet
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					2db7795eb7 | ||
| 
						 | 
					dd5a9e2216 | ||
| 
						 | 
					00d1543f08 | 
							
								
								
									
										3
									
								
								.github/workflows/sponsors.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/sponsors.yml
									
									
									
									
										vendored
									
									
								
							@@ -13,7 +13,8 @@ jobs:
 | 
				
			|||||||
        uses: JamesIves/github-sponsors-readme-action@v1
 | 
					        uses: JamesIves/github-sponsors-readme-action@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          token: ${{ secrets.SPONSORS_GENERATOR_PAT }}
 | 
					          token: ${{ secrets.SPONSORS_GENERATOR_PAT }}
 | 
				
			||||||
          file: README.md
 | 
					          active-only: false
 | 
				
			||||||
 | 
					          file: "README.md"
 | 
				
			||||||
          template: '<a href="https://github.com/{{{ login }}}"><img src="{{{ avatarUrl }}}" width="64px" alt="User avatar: {{{ login }}}" /></a>  '
 | 
					          template: '<a href="https://github.com/{{{ login }}}"><img src="{{{ avatarUrl }}}" width="64px" alt="User avatar: {{{ login }}}" /></a>  '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Create Pull Request
 | 
					      - name: Create Pull Request
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,7 +53,7 @@ Tinyauth is licensed under the GNU General Public License v3.0. TL;DR — You ma
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Thanks a lot to the following people for providing me with more coffee:
 | 
					Thanks a lot to the following people for providing me with more coffee:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- sponsors --><a href="https://github.com/nicotsx"><img src="https://github.com/nicotsx.png" width="64px" alt="User avatar: nicotsx" /></a>  <a href="https://github.com/SimpleHomelab"><img src="https://github.com/SimpleHomelab.png" width="64px" alt="User avatar: SimpleHomelab" /></a>  <a href="https://github.com/jmadden91"><img src="https://github.com/jmadden91.png" width="64px" alt="User avatar: jmadden91" /></a>  <a href="https://github.com/tribor"><img src="https://github.com/tribor.png" width="64px" alt="User avatar: tribor" /></a>  <!-- sponsors -->
 | 
					<!-- sponsors --><a href="https://github.com/erwinkramer"><img src="https://github.com/erwinkramer.png" width="64px" alt="User avatar: erwinkramer" /></a>  <a href="https://github.com/nicotsx"><img src="https://github.com/nicotsx.png" width="64px" alt="User avatar: nicotsx" /></a>  <a href="https://github.com/SimpleHomelab"><img src="https://github.com/SimpleHomelab.png" width="64px" alt="User avatar: SimpleHomelab" /></a>  <a href="https://github.com/jmadden91"><img src="https://github.com/jmadden91.png" width="64px" alt="User avatar: jmadden91" /></a>  <a href="https://github.com/tribor"><img src="https://github.com/tribor.png" width="64px" alt="User avatar: tribor" /></a>  <!-- sponsors -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Acknowledgements
 | 
					## Acknowledgements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@@ -12,6 +12,7 @@ export default defineConfig({
 | 
				
			|||||||
        changeOrigin: true,
 | 
					        changeOrigin: true,
 | 
				
			||||||
        rewrite: (path) => path.replace(/^\/api/, ""),
 | 
					        rewrite: (path) => path.replace(/^\/api/, ""),
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
 | 
					    allowedHosts: true,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,8 +110,8 @@ func (hooks *Hooks) UseUserContext(c *gin.Context) types.UserContext {
 | 
				
			|||||||
		log.Debug().Msg("Provider exists")
 | 
							log.Debug().Msg("Provider exists")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Check if the oauth email is whitelisted
 | 
							// Check if the oauth email is whitelisted
 | 
				
			||||||
		if !hooks.Auth.EmailWhitelisted(cookie.Username) {
 | 
							if !hooks.Auth.EmailWhitelisted(cookie.Email) {
 | 
				
			||||||
			log.Error().Str("email", cookie.Username).Msg("Email is not whitelisted")
 | 
								log.Error().Str("email", cookie.Email).Msg("Email is not whitelisted")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// It isn't so we delete the cookie and return an empty context
 | 
								// It isn't so we delete the cookie and return an empty context
 | 
				
			||||||
			hooks.Auth.DeleteSessionCookie(c)
 | 
								hooks.Auth.DeleteSessionCookie(c)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,6 +103,7 @@ func GetGithubUser(client *http.Client) (constants.Claims, error) {
 | 
				
			|||||||
	for _, email := range emails {
 | 
						for _, email := range emails {
 | 
				
			||||||
		if email.Primary {
 | 
							if email.Primary {
 | 
				
			||||||
			// Set the email then exit
 | 
								// Set the email then exit
 | 
				
			||||||
 | 
								log.Debug().Str("email", email.Email).Msg("Found primary email")
 | 
				
			||||||
			user.Email = email.Email
 | 
								user.Email = email.Email
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -115,6 +116,7 @@ func GetGithubUser(client *http.Client) (constants.Claims, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Set the email if it is not set picking the first one
 | 
						// Set the email if it is not set picking the first one
 | 
				
			||||||
	if user.Email == "" {
 | 
						if user.Email == "" {
 | 
				
			||||||
 | 
							log.Warn().Str("email", emails[0].Email).Msg("No primary email found, using first email")
 | 
				
			||||||
		user.Email = emails[0].Email
 | 
							user.Email = emails[0].Email
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user