Show a link to password reset from password change and delete account (#862)
It's helpful when you forgot your password thus cannot change it (can happen if you log in via OAuth2 or OpenID) Also make sure that both the delete-account and password-change links to forgot-password will have the primary email pre-filledrelease/v1.15
parent
c99e7e1a62
commit
8a98a25d8e
|
@ -872,6 +872,9 @@ func ForgotPasswd(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
email := ctx.Query("email")
|
||||||
|
ctx.Data["Email"] = email
|
||||||
|
|
||||||
ctx.Data["IsResetRequest"] = true
|
ctx.Data["IsResetRequest"] = true
|
||||||
ctx.HTML(200, tplForgotPassword)
|
ctx.HTML(200, tplForgotPassword)
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
func SettingsPassword(ctx *context.Context) {
|
func SettingsPassword(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsPassword"] = true
|
ctx.Data["PageIsSettingsPassword"] = true
|
||||||
|
ctx.Data["Email"] = ctx.User.Email
|
||||||
ctx.HTML(200, tplSettingsPassword)
|
ctx.HTML(200, tplSettingsPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +201,7 @@ func SettingsPassword(ctx *context.Context) {
|
||||||
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsPassword"] = true
|
ctx.Data["PageIsSettingsPassword"] = true
|
||||||
|
ctx.Data["PageIsSettingsDelete"] = true
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, tplSettingsPassword)
|
ctx.HTML(200, tplSettingsPassword)
|
||||||
|
@ -684,6 +686,7 @@ func SettingsDeleteAccountLink(ctx *context.Context) {
|
||||||
func SettingsDelete(ctx *context.Context) {
|
func SettingsDelete(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsDelete"] = true
|
ctx.Data["PageIsSettingsDelete"] = true
|
||||||
|
ctx.Data["Email"] = ctx.User.Email
|
||||||
|
|
||||||
if ctx.Req.Method == "POST" {
|
if ctx.Req.Method == "POST" {
|
||||||
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
<div class="ui red button delete-button" data-type="form" data-form="#delete-form">
|
<div class="ui red button delete-button" data-type="form" data-form="#delete-form">
|
||||||
{{.i18n.Tr "settings.confirm_delete_account"}}
|
{{.i18n.Tr "settings.confirm_delete_account"}}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="{{AppSubUrl}}/user/forget_password?email={{.Email}}">{{.i18n.Tr "auth.forget_password"}}</a>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
|
<button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
|
||||||
|
<a href="{{AppSubUrl}}/user/forget_password?email={{.Email}}">{{.i18n.Tr "auth.forget_password"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
Loading…
Reference in New Issue