mirror of
https://github.com/writeas/writefreely
synced 2025-01-09 06:20:17 +01:00
f404f7b928
This adds a self-serve password reset page. Users can enter their username and receive an email with a link that will let them create a new password. If they've never set a password, it will send them a one-time login link (building on #776) that will then take them to their Account Settings page. If they don't have an email associated with their account, they'll be instructed to contact the admin, so they can manually reset the password. Includes changes to the stylesheet and database, so run: make ui writefreely db migrate Closes T508
38 lines
807 B
Go
38 lines
807 B
Go
/*
|
|
* Copyright © 2023 Musing Studio LLC.
|
|
*
|
|
* This file is part of WriteFreely.
|
|
*
|
|
* WriteFreely is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License, included
|
|
* in the LICENSE file in this source code package.
|
|
*/
|
|
|
|
package migrations
|
|
|
|
func supportPassReset(db *datastore) error {
|
|
t, err := db.Begin()
|
|
if err != nil {
|
|
t.Rollback()
|
|
return err
|
|
}
|
|
|
|
_, err = t.Exec(`CREATE TABLE password_resets (
|
|
user_id ` + db.typeInt() + ` not null,
|
|
token ` + db.typeChar(32) + ` not null primary key,
|
|
used ` + db.typeBool() + ` default 0 not null,
|
|
created ` + db.typeDateTime() + ` not null
|
|
)`)
|
|
if err != nil {
|
|
t.Rollback()
|
|
return err
|
|
}
|
|
|
|
err = t.Commit()
|
|
if err != nil {
|
|
t.Rollback()
|
|
return err
|
|
}
|
|
return nil
|
|
}
|