From e8241bf55e0ff683933f9c7b51b8ee5956965bdf Mon Sep 17 00:00:00 2001
From: Benno <blueworrybear@gmail.com>
Date: Mon, 25 Nov 2019 04:17:53 +0800
Subject: [PATCH] update #9066 Always show Password field on link account sign
 in page (#9147)

---
 routers/user/auth.go                  | 1 +
 templates/user/auth/signin_inner.tmpl | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/routers/user/auth.go b/routers/user/auth.go
index 1596e11bbb..258b5e03d7 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -788,6 +788,7 @@ func LinkAccountPostSignIn(ctx *context.Context, signInForm auth.SignInForm) {
 	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)
diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl
index 90519c439c..9850058e5e 100644
--- a/templates/user/auth/signin_inner.tmpl
+++ b/templates/user/auth/signin_inner.tmpl
@@ -15,7 +15,7 @@
 				<label for="user_name">{{.i18n.Tr "home.uname_holder"}}</label>
 				<input id="user_name" name="user_name" value="{{.user_name}}" autofocus required>
 			</div>
-			{{if not .DisablePassword}}
+			{{if or (not .DisablePassword) .LinkAccountMode}}
 			<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
 				<label for="password">{{.i18n.Tr "password"}}</label>
 				<input id="password" name="password" type="password" value="{{.password}}" autocomplete="off" required>