Fixed the ability to change usernames #?

Fixed the ability to change passwords #4
You are now redirected to the index after changing your password.
Removed a new obsolete phrase.
This commit is contained in:
Azareal 2018-05-11 16:53:31 +10:00
parent 73c4f373e5
commit b1d28b3046
4 changed files with 4 additions and 14 deletions

View File

@ -234,7 +234,6 @@
"NoticePhrases": {
"account_banned":"Your account has been suspended. Some of your permissions may have been revoked.",
"account_inactive":"Your account hasn't been activated yet. Some features may remain unavailable until it is.",
"account_password_updated":"Your password was successfully updated",
"account_avatar_updated":"Your avatar was successfully updated",
"account_username_updated":"Your username was successfully updated",
"account_mail_disabled":"The mail system is currently disabled.",

View File

@ -259,7 +259,7 @@ func routeReportSubmit(w http.ResponseWriter, r *http.Request, user common.User,
}
func routeAccountEditCriticalSubmit(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
headerVars, ferr := common.UserCheck(w, r, &user)
_, ferr := common.SimpleUserCheck(w, r, &user)
if ferr != nil {
return ferr
}
@ -289,16 +289,7 @@ func routeAccountEditCriticalSubmit(w http.ResponseWriter, r *http.Request, user
// Log the user out as a safety precaution
common.Auth.ForceLogout(user.ID)
headerVars.NoticeList = append(headerVars.NoticeList, common.GetNoticePhrase("account_password_updated"))
pi := common.Page{"Edit Password", user, headerVars, tList, nil}
if common.RunPreRenderHook("pre_render_account_own_edit_critical", w, r, &user, &pi) {
return nil
}
err = common.Templates.ExecuteTemplate(w, "account_own_edit.html", pi)
if err != nil {
return common.InternalError(err, w, r)
}
http.Redirect(w, r, "/", http.StatusSeeOther)
return nil
}

View File

@ -6,7 +6,7 @@
<div class="rowitem"><h1>{{lang "account_password_head"}}</h1></div>
</div>
<div class="colstack_item the_form">
<form action="/user/edit/critical/submit/" method="post">
<form action="/user/edit/critical/submit/?session={{.CurrentUser.Session}}" method="post">
<div class="formrow real_first_child">
<div class="formitem formlabel"><a>{{lang "account_password_current_password"}}</a></div>
<div class="formitem"><input name="account-current-password" type="password" placeholder="*****" required /></div>

View File

@ -6,7 +6,7 @@
<div class="rowitem"><h1>{{lang "account_username_head"}}</h1></div>
</div>
<div class="colstack_item the_form">
<form action="/user/edit/username/submit/" method="post">
<form action="/user/edit/username/submit/?session={{.CurrentUser.Session}}" method="post">
<div class="formrow real_first_child">
<div class="formitem formlabel"><a>{{lang "account_username_current_username"}}</a></div>
<div class="formitem formlabel">{{.CurrentUser.Name}}</div>