MCPcopy
hub / github.com/writefreely/writefreely / adminResetPassword

Function adminResetPassword

admin.go:646–657  ·  view source on GitHub ↗
(app *App, u *User, newPass string)

Source from the content-addressed store, hash-verified

644}
645
646func adminResetPassword(app *App, u *User, newPass string) error {
647 hashedPass, err := auth.HashPass([]byte(newPass))
648 if err != nil {
649 return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not create password hash: %v", err)}
650 }
651
652 err = app.db.ChangePassphrase(u.ID, true, "", hashedPass)
653 if err != nil {
654 return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not update passphrase: %v", err)}
655 }
656 return nil
657}
658
659func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
660 check := r.URL.Query().Get("check")

Callers 1

ResetPasswordFunction · 0.85

Calls 1

ChangePassphraseMethod · 0.65

Tested by

no test coverage detected