mirror of
https://github.com/renorris/openfsd
synced 2026-04-26 18:55:45 +08:00
update
Bug fixes: - Fix re-hashing an already hashed password in UpdateUserRecord - Fix validator incorrectly flagging swift client name - Switched a > to a < when checking field length for #TM packets Misc: - Simplify client reader goroutine - Simplify client writer logic Features: - Add an option to enable plaintext passwords (replacing the JWT token in the AddPilotPDU `token` field.)
This commit is contained in:
@@ -15,6 +15,8 @@ type FSDUserRecord struct {
|
||||
CreationTime time.Time `json:"creation_time"`
|
||||
}
|
||||
|
||||
// GetUserRecord returns a user record for a given CID
|
||||
// If no user is found, this is not an error. FSDUserRecord will be nil, and error will be nil.
|
||||
func GetUserRecord(db *sql.DB, cid int) (*FSDUserRecord, error) {
|
||||
row := db.QueryRow("SELECT * FROM users WHERE cid=? LIMIT 1", cid)
|
||||
|
||||
@@ -24,7 +26,11 @@ func GetUserRecord(db *sql.DB, cid int) (*FSDUserRecord, error) {
|
||||
var realName string
|
||||
var creationTime time.Time
|
||||
|
||||
if err := row.Scan(&cidRecord, &pwd, &rating, &realName, &creationTime); errors.Is(err, sql.ErrNoRows) {
|
||||
err := row.Scan(&cidRecord, &pwd, &rating, &realName, &creationTime)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user