Skip to content

Show a link to password reset from user settings requiring a password #862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions routers/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ func ForgotPasswd(ctx *context.Context) {
return
}

email := ctx.Query("email")
ctx.Data["Email"] = email

ctx.Data["IsResetRequest"] = true
ctx.HTML(200, tplForgotPassword)
}
Expand Down
3 changes: 3 additions & 0 deletions routers/user/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,15 @@ func SettingsDeleteAvatar(ctx *context.Context) {
func SettingsPassword(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
ctx.Data["Email"] = ctx.User.Email
ctx.HTML(200, tplSettingsPassword)
}

// SettingsPasswordPost response for change user's password
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
ctx.Data["PageIsSettingsDelete"] = true

if ctx.HasError() {
ctx.HTML(200, tplSettingsPassword)
Expand Down Expand Up @@ -684,6 +686,7 @@ func SettingsDeleteAccountLink(ctx *context.Context) {
func SettingsDelete(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsDelete"] = true
ctx.Data["Email"] = ctx.User.Email

if ctx.Req.Method == "POST" {
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions templates/user/settings/delete.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<div class="ui red button delete-button" data-type="form" data-form="#delete-form">
{{.i18n.Tr "settings.confirm_delete_account"}}
</div>
<div>
<a href="{{AppSubUrl}}/user/forget_password?email={{.Email}}">{{.i18n.Tr "auth.forget_password"}}</a>
</div>
</form>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions templates/user/settings/password.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

<div class="field">
<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>
</form>
{{else}}
Expand Down