func LinkAccountPostSignIn(ctx *context.Context) {
	signInForm := web.GetForm(ctx).(*forms.SignInForm)
	ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationPassword || setting.Service.AllowOnlyExternalRegistration
	ctx.Data["Title"] = ctx.Tr("link_account")
	ctx.Data["LinkAccountMode"] = true
	ctx.Data["LinkAccountModeSignIn"] = true
	ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha && setting.Service.RequireExternalRegistrationCaptcha
	ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
	ctx.Data["Captcha"] = context.GetImageCaptcha()
	ctx.Data["CaptchaType"] = setting.Service.CaptchaType
	ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
	ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
	ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
	ctx.Data["ShowRegistrationButton"] = false

	// use this to set the right link into the signIn and signUp templates in the link_account template
	ctx.Data["SignInLink"] = setting.AppSubURL + "/user/link_account_signin"
	ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/link_account_signup"

	gothUser := ctx.Session.Get("linkAccountGothUser")
	if gothUser == nil {
		ctx.ServerError("UserSignIn", errors.New("not in LinkAccount session"))
		return
	}

	if ctx.HasError() {
		ctx.HTML(http.StatusOK, tplLinkAccount)
		return
	}

	u, err := models.UserSignIn(signInForm.UserName, signInForm.Password)
	if err != nil {
		if models.IsErrUserNotExist(err) {
			ctx.Data["user_exists"] = true
			ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplLinkAccount, &signInForm)
		} else {
			ctx.ServerError("UserLinkAccount", err)
		}
		return
	}

	linkAccount(ctx, u, gothUser.(goth.User), signInForm.Remember)
}
// LinkAccountPostSignIn handle the coupling of external account with another account using signIn
LinkAccountPostSignIn handle the coupling of external account with another account using signIn
// LinkAccountPostSignIn handle the coupling of external account with another account using signIn
func LinkAccountPostSignIn(ctx *context.Context) {
	signInForm := web.GetForm(ctx).(*forms.SignInForm)
	ctx.Data["DisablePassword"] = !setting.Service.RequireExternalRegistrationPassword || setting.Service.AllowOnlyExternalRegistration
	ctx.Data["Title"] = ctx.Tr("link_account")
	ctx.Data["LinkAccountMode"] = true
	ctx.Data["LinkAccountModeSignIn"] = true
	ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha && setting.Service.RequireExternalRegistrationCaptcha
	ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
	ctx.Data["Captcha"] = context.GetImageCaptcha()
	ctx.Data["CaptchaType"] = setting.Service.CaptchaType
	ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
	ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
	ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
	ctx.Data["ShowRegistrationButton"] = false
	ctx.Data["SignInLink"] = setting.AppSubURL + "/user/link_account_signin"
	ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/link_account_signup"
	gothUser := ctx.Session.Get("linkAccountGothUser")
	if gothUser == nil {
		ctx.ServerError("UserSignIn", errors.New("not in LinkAccount session"))
		return
	}
	if ctx.HasError() {
		ctx.HTML(http.StatusOK, tplLinkAccount)
		return
	}
	u, err := models.UserSignIn(signInForm.UserName, signInForm.Password)
	if err != nil {
		if models.IsErrUserNotExist(err) {
			ctx.Data["user_exists"] = true
			ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplLinkAccount, &signInForm)
		} else {
			ctx.ServerError("UserLinkAccount", err)
		}
		return
	}
	linkAccount(ctx, u, gothUser.(goth.User), signInForm.Remember)
}
func LinkAccountPostSignIn ( ctx * context . Context ) { signInForm := web . GetForm ( ctx ) . ( * forms . SignInForm ) ctx . Data [ " " ] = ! setting . Service . RequireExternalRegistrationPassword || setting . Service . AllowOnlyExternalRegistration ctx . Data [ " " ] = ctx . Tr ( " " ) ctx . Data [ " " ] = true ctx . Data [ " " ] = true ctx . Data [ " " ] = setting . Service . EnableCaptcha && setting . Service . RequireExternalRegistrationCaptcha ctx . Data [ " " ] = setting . Service . RecaptchaURL ctx . Data [ " " ] = context . GetImageCaptcha ( ) ctx . Data [ " " ] = setting . Service . CaptchaType ctx . Data [ " " ] = setting . Service . RecaptchaSitekey ctx . Data [ " " ] = setting . Service . HcaptchaSitekey ctx . Data [ " " ] = setting . Service . DisableRegistration ctx . Data [ " " ] = false ctx . Data [ " " ] = setting . AppSubURL + " " ctx . Data [ " " ] = setting . AppSubURL + " " gothUser := ctx . Session . Get ( " " ) if gothUser == nil { ctx . ServerError ( " " , errors . New ( " " ) ) return } if ctx . HasError ( ) { ctx . HTML ( http . StatusOK , tplLinkAccount ) return } u , err := models . UserSignIn ( signInForm . UserName , signInForm . Password ) if err != nil { if models . IsErrUserNotExist ( err ) { ctx . Data [ " " ] = true ctx . RenderWithErr ( ctx . Tr ( " " ) , tplLinkAccount , & signInForm ) } else { ctx . ServerError ( " " , err ) } return } linkAccount ( ctx , u , gothUser . ( goth . User ) , signInForm . Remember ) }
LinkAccountPostSignIn handle the coupling of external account with another account using signIn
LinkAccountPostSignIn handle the coupling of external account with another account using signIn
// use this to set the right link into the signIn and signUp templates in the link_account template