Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Username in the forgot password flow now uses case-insensitive search in the DB, matching the behavior of the login flow (and the existing-user check in user creation).
  • Loading branch information
challf committed Dec 16, 2023
1 parent f3b667f commit e31bc04
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/swiftarr/Controllers/AuthController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ struct AuthController: APIRouteCollection {
// see `UserRecoveryData.validations()`
let data = try ValidatingJSONDecoder().decode(UserRecoveryData.self, fromBodyOf: req)
// find data.username user
let user = try await User.query(on: req.db).filter(\.$username == data.username).first()
guard let user = user else {
guard let user = try await User.query(on: req.db).filter(\.$username, .custom("ilike"), data.username).first() else {
throw Abort(.badRequest, reason: "username \"\(data.username)\" not found")
}
// no login for punks
Expand Down

0 comments on commit e31bc04

Please sign in to comment.