MCPcopy
hub / github.com/writefreely/writefreely / doAutomatedPasswordChange

Function doAutomatedPasswordChange

account.go:1306–1319  ·  view source on GitHub ↗
(app *App, userID int64, newPass string)

Source from the content-addressed store, hash-verified

1304}
1305
1306func doAutomatedPasswordChange(app *App, userID int64, newPass string) error {
1307 // Do password reset
1308 hashedPass, err := auth.HashPass([]byte(newPass))
1309 if err != nil {
1310 return impart.HTTPError{http.StatusInternalServerError, "Could not create password hash."}
1311 }
1312
1313 // Do update
1314 err = app.db.ChangePassphrase(userID, true, "", hashedPass)
1315 if err != nil {
1316 return err
1317 }
1318 return nil
1319}
1320
1321func handleResetPasswordInit(app *App, w http.ResponseWriter, r *http.Request) error {
1322 returnLoc := impart.HTTPError{http.StatusFound, "/reset"}

Callers 1

viewResetPasswordFunction · 0.85

Calls 1

ChangePassphraseMethod · 0.65

Tested by

no test coverage detected