template issue at login page #7671

Closed
opened 2025-11-02 07:33:02 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @6543 on GitHub (Aug 8, 2021).

ab9bb54144 introduced an issue:

500 page:

template: user/auth/signin_inner:64:26: executing "user/auth/signin_inner" at <$provider.DisplayName>: error calling DisplayName: runtime error: invalid memory address or nil pointer dereference
Originally created by @6543 on GitHub (Aug 8, 2021). ab9bb54144f136bbbba2ce2e94fd88c0be0ee1cf introduced an issue: 500 page: ``` template: user/auth/signin_inner:64:26: executing "user/auth/signin_inner" at <$provider.DisplayName>: error calling DisplayName: runtime error: invalid memory address or nil pointer dereference ```
GiteaMirror added the issue/regressiontype/bug labels 2025-11-02 07:33:02 -06:00
Author
Owner

@6543 commented on GitHub (Aug 8, 2021):

cc @zeripath

@6543 commented on GitHub (Aug 8, 2021): ~~cc @zeripath~~
Author
Owner

@6543 commented on GitHub (Aug 8, 2021):

never mind it was a relict of an wip pull try to get steam oauth2 -> so there was no "steam" witch result in an nil the template can not handle

@6543 commented on GitHub (Aug 8, 2021): never mind it was a relict of an wip pull try to get steam oauth2 -> so there was no "steam" witch result in an nil the template can not handle
Author
Owner

@zeripath commented on GitHub (Aug 9, 2021):

@6543 adding the steam authentication would now be very easy:

  • Apply this patch:
diff --git a/services/auth/source/oauth2/providers_simple.go b/services/auth/source/oauth2/providers_simple.go
index 5a7062e6c..674984118 100644
--- a/services/auth/source/oauth2/providers_simple.go
+++ b/services/auth/source/oauth2/providers_simple.go
@@ -15,6 +15,7 @@ import (
 	"github.com/markbates/goth/providers/facebook"
 	"github.com/markbates/goth/providers/google"
 	"github.com/markbates/goth/providers/microsoftonline"
+	"github.com/markbates/goth/providers/steam"
 	"github.com/markbates/goth/providers/twitter"
 	"github.com/markbates/goth/providers/yandex"
 )
@@ -105,4 +106,11 @@ func init() {
 		},
 	))
 
+	RegisterGothProvider(NewSimpleProvider(
+		"steam", "Steam", nil,
+		func(clientID, secret, callbackURL string, scopes ...string) goth.Provider {
+			return steam.New(secret, callbackURL)
+		},
+	))
+
 }
  • run make vendor.

  • add an appropriate icon as public/img/auth/steam.png

  • consider if you might want to add some information to templates/admin/auth/new.tmpl - I missed doing this step with the Microsoft Auth providers - (TBH these tips should show only when you select the particular oauth2 provider so that there's no need to change the template in future - this would be a worthy refactor if you were planning to add the Steam provider as a PR.)

@zeripath commented on GitHub (Aug 9, 2021): @6543 adding the steam authentication would now be very easy: * Apply this patch: ```patch diff --git a/services/auth/source/oauth2/providers_simple.go b/services/auth/source/oauth2/providers_simple.go index 5a7062e6c..674984118 100644 --- a/services/auth/source/oauth2/providers_simple.go +++ b/services/auth/source/oauth2/providers_simple.go @@ -15,6 +15,7 @@ import ( "github.com/markbates/goth/providers/facebook" "github.com/markbates/goth/providers/google" "github.com/markbates/goth/providers/microsoftonline" + "github.com/markbates/goth/providers/steam" "github.com/markbates/goth/providers/twitter" "github.com/markbates/goth/providers/yandex" ) @@ -105,4 +106,11 @@ func init() { }, )) + RegisterGothProvider(NewSimpleProvider( + "steam", "Steam", nil, + func(clientID, secret, callbackURL string, scopes ...string) goth.Provider { + return steam.New(secret, callbackURL) + }, + )) + } ``` * run `make vendor`. * add an appropriate icon as `public/img/auth/steam.png` * consider if you might want to add some information to `templates/admin/auth/new.tmpl` - I missed doing this step with the Microsoft Auth providers - (TBH these tips should show only when you select the particular oauth2 provider so that there's no need to change the template in future - this would be a worthy refactor if you were planning to add the Steam provider as a PR.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7671