mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-30 21:55:43 +00:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			v4.0.0-alp
			...
			dad0718091
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | dad0718091 | ||
|   | d4069900bc | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | a54996d72d | ||
|   | 085f6257c5 | 
| @@ -1,5 +1,5 @@ | ||||
| # Site builder | ||||
| FROM oven/bun:1.2.22-alpine AS frontend-builder | ||||
| FROM oven/bun:1.2.23-alpine AS frontend-builder | ||||
|  | ||||
| WORKDIR /frontend | ||||
|  | ||||
|   | ||||
| @@ -8,6 +8,7 @@ | ||||
|     <link rel="shortcut icon" href="/favicon.ico" /> | ||||
|     <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> | ||||
|     <meta name="apple-mobile-web-app-title" content="Tinyauth" /> | ||||
|     <meta name="robots" content="noindex" /> | ||||
|     <link rel="manifest" href="/site.webmanifest" /> | ||||
|     <title>Tinyauth</title> | ||||
|   </head> | ||||
|   | ||||
| @@ -44,6 +44,7 @@ export const TotpForm = (props: Props) => { | ||||
|                   disabled={loading} | ||||
|                   {...field} | ||||
|                   autoComplete="one-time-code" | ||||
|                   autoFocus | ||||
|                 > | ||||
|                   <InputOTPGroup> | ||||
|                     <InputOTPSlot index={0} /> | ||||
|   | ||||
| @@ -147,10 +147,6 @@ func (app *BootstrapApp) Setup() error { | ||||
| 	} | ||||
|  | ||||
| 	// Configured providers | ||||
| 	babysit := map[string]string{ | ||||
| 		"google": "Google", | ||||
| 		"github": "GitHub", | ||||
| 	} | ||||
| 	configuredProviders := make([]controller.Provider, 0) | ||||
|  | ||||
| 	for id, provider := range oauthProviders { | ||||
| @@ -159,7 +155,7 @@ func (app *BootstrapApp) Setup() error { | ||||
| 		} | ||||
|  | ||||
| 		if provider.Name == "" { | ||||
| 			if name, ok := babysit[id]; ok { | ||||
| 			if name, ok := config.OverrideProviders[id]; ok { | ||||
| 				provider.Name = name | ||||
| 			} else { | ||||
| 				provider.Name = utils.Capitalize(id) | ||||
|   | ||||
| @@ -65,6 +65,11 @@ type OAuthServiceConfig struct { | ||||
| 	Name               string   `key:"name"` | ||||
| } | ||||
|  | ||||
| var OverrideProviders = map[string]string{ | ||||
| 	"google": "Google", | ||||
| 	"github": "GitHub", | ||||
| } | ||||
|  | ||||
| // User/session related stuff | ||||
|  | ||||
| type User struct { | ||||
|   | ||||
| @@ -309,12 +309,14 @@ func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserConte | ||||
| 		return true | ||||
| 	} | ||||
|  | ||||
| 	if context.Provider != "generic" { | ||||
| 		log.Debug().Msg("Not using generic provider, skipping group check") | ||||
| 		return true | ||||
| 	for id := range config.OverrideProviders { | ||||
| 		if context.Provider == id { | ||||
| 			log.Info().Str("provider", id).Msg("OAuth groups not supported for this provider") | ||||
| 			return true | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	for _, userGroup := range strings.Split(context.OAuthGroups, ",") { | ||||
| 	for userGroup := range strings.SplitSeq(context.OAuthGroups, ",") { | ||||
| 		if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) { | ||||
| 			return true | ||||
| 		} | ||||
|   | ||||
| @@ -183,14 +183,13 @@ func GetOAuthProvidersConfig(env []string, args []string, appUrl string) (map[st | ||||
| 		providers[name] = provider | ||||
| 	} | ||||
|  | ||||
| 	// If we have google/github providers and no redirect URL babysit them | ||||
| 	babysitProviders := []string{"google", "github"} | ||||
| 	// If we have google/github providers and no redirect URL then set a default | ||||
|  | ||||
| 	for _, name := range babysitProviders { | ||||
| 		if provider, exists := providers[name]; exists { | ||||
| 	for id := range config.OverrideProviders { | ||||
| 		if provider, exists := providers[id]; exists { | ||||
| 			if provider.RedirectURL == "" { | ||||
| 				provider.RedirectURL = appUrl + "/api/oauth/callback/" + name | ||||
| 				providers[name] = provider | ||||
| 				provider.RedirectURL = appUrl + "/api/oauth/callback/" + id | ||||
| 				providers[id] = provider | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user