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:
Reese Norris
2024-09-14 12:20:34 -07:00
parent 257d891df5
commit de94e668f0
12 changed files with 274 additions and 277 deletions

View File

@@ -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
}