Accept Apper in writefreely.ResetPassword()

instead of *App
pull/137/head
Matt Baer 6 years ago
parent 79cf6ce0eb
commit 3b079810bb
  1. 12
      app.go

@ -577,14 +577,14 @@ func Migrate(apper Apper) error {
} }
// ResetPassword runs the interactive password reset process. // ResetPassword runs the interactive password reset process.
func ResetPassword(app *App, username string) error { func ResetPassword(apper Apper, username string) error {
// Connect to the database // Connect to the database
app.LoadConfig() apper.LoadConfig()
connectToDatabase(app) connectToDatabase(apper.App())
defer shutdown(app) defer shutdown(apper.App())
// Fetch user // Fetch user
u, err := app.db.GetUserForAuth(username) u, err := apper.App().db.GetUserForAuth(username)
if err != nil { if err != nil {
log.Error("Get user: %s", err) log.Error("Get user: %s", err)
os.Exit(1) os.Exit(1)
@ -606,7 +606,7 @@ func ResetPassword(app *App, username string) error {
// Do the update // Do the update
log.Info("Updating...") log.Info("Updating...")
err = adminResetPassword(app, u, newPass) err = adminResetPassword(apper.App(), u, newPass)
if err != nil { if err != nil {
log.Error("%s", err) log.Error("%s", err)
os.Exit(1) os.Exit(1)

Loading…
Cancel
Save