@@ -29,6 +29,7 @@ var tplLinkAccount templates.TplName = "user/auth/link_account"
2929
3030// LinkAccount shows the page where the user can decide to login or create a new account
3131func LinkAccount (ctx * context.Context ) {
32+ // FIXME: these common template variables should be prepared in one common function, but not just copy-paste again and again.
3233 ctx .Data ["DisablePassword" ] = ! setting .Service .RequireExternalRegistrationPassword || setting .Service .AllowOnlyExternalRegistration
3334 ctx .Data ["Title" ] = ctx .Tr ("link_account" )
3435 ctx .Data ["LinkAccountMode" ] = true
@@ -43,13 +44,19 @@ func LinkAccount(ctx *context.Context) {
4344 ctx .Data ["CfTurnstileSitekey" ] = setting .Service .CfTurnstileSitekey
4445 ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
4546 ctx .Data ["AllowOnlyInternalRegistration" ] = setting .Service .AllowOnlyInternalRegistration
47+ ctx .Data ["EnablePasswordSignInForm" ] = setting .Service .EnablePasswordSignInForm
4648 ctx .Data ["ShowRegistrationButton" ] = false
4749
4850 // use this to set the right link into the signIn and signUp templates in the link_account template
4951 ctx .Data ["SignInLink" ] = setting .AppSubURL + "/user/link_account_signin"
5052 ctx .Data ["SignUpLink" ] = setting .AppSubURL + "/user/link_account_signup"
5153
5254 gothUser , ok := ctx .Session .Get ("linkAccountGothUser" ).(goth.User )
55+
56+ // If you'd like to quickly debug the "link account" page layout, just uncomment the blow line
57+ // Don't worry, when the below line exists, the lint won't pass: ineffectual assignment to gothUser (ineffassign)
58+ // gothUser, ok = goth.User{Email: "invalid-email", Name: "."}, true // intentionally use invalid data to avoid pass the registration check
59+
5360 if ! ok {
5461 // no account in session, so just redirect to the login page, then the user could restart the process
5562 ctx .Redirect (setting .AppSubURL + "/user/login" )
@@ -135,6 +142,8 @@ func LinkAccountPostSignIn(ctx *context.Context) {
135142 ctx .Data ["McaptchaURL" ] = setting .Service .McaptchaURL
136143 ctx .Data ["CfTurnstileSitekey" ] = setting .Service .CfTurnstileSitekey
137144 ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
145+ ctx .Data ["AllowOnlyInternalRegistration" ] = setting .Service .AllowOnlyInternalRegistration
146+ ctx .Data ["EnablePasswordSignInForm" ] = setting .Service .EnablePasswordSignInForm
138147 ctx .Data ["ShowRegistrationButton" ] = false
139148
140149 // use this to set the right link into the signIn and signUp templates in the link_account template
@@ -223,6 +232,8 @@ func LinkAccountPostRegister(ctx *context.Context) {
223232 ctx .Data ["McaptchaURL" ] = setting .Service .McaptchaURL
224233 ctx .Data ["CfTurnstileSitekey" ] = setting .Service .CfTurnstileSitekey
225234 ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
235+ ctx .Data ["AllowOnlyInternalRegistration" ] = setting .Service .AllowOnlyInternalRegistration
236+ ctx .Data ["EnablePasswordSignInForm" ] = setting .Service .EnablePasswordSignInForm
226237 ctx .Data ["ShowRegistrationButton" ] = false
227238
228239 // use this to set the right link into the signIn and signUp templates in the link_account template
0 commit comments