<commit_before>import Authentication
import HTTP
import JWT
import Routing
import Vapor

/// Defines basic user authorization routes.
public struct ApiUserRoutes: RouteCollection {
    public typealias Wrapped = Responder
    
    private let authMiddleware: Middleware
    private let controller: UserControllerType

    /// Initializes the user route collection.
    ///
    /// - Parameters:
    ///   - authMiddleware: authentication middleware.
    ///   - userController: controller for handling user routes.
    /// - Throws: if configuration cannot be created.
    public init(
        authMiddleware: Middleware,
        userController: UserControllerType
    ) {
        self.authMiddleware = authMiddleware
        self.controller = userController
    }

    public func build(
        _ builder: RouteBuilder
    ) throws {
        // Get the base path group
        let path = builder.grouped("users")
        
        // Auth routes
        path.post(handler: controller.register)
        path.post("login", handler: controller.logIn)
        path.post("reset-password", "request", handler: controller.resetPasswordEmail)

        // Protected routes
        path.group(authMiddleware) { secured in
            secured.get("logout", handler: controller.logOut)
            secured.get("me", handler: controller.me)
            secured.patch("token", "regenerate", handler: controller.regenerate)
            secured.patch("update", handler: controller.update)
        }
    }
}<commit_msg>make reset password a GET action<commit_after>import Authentication
import HTTP
import JWT
import Routing
import Vapor

/// Defines basic user authorization routes.
public struct ApiUserRoutes: RouteCollection {
    public typealias Wrapped = Responder
    
    private let authMiddleware: Middleware
    private let controller: UserControllerType

    /// Initializes the user route collection.
    ///
    /// - Parameters:
    ///   - authMiddleware: authentication middleware.
    ///   - userController: controller for handling user routes.
    /// - Throws: if configuration cannot be created.
    public init(
        authMiddleware: Middleware,
        userController: UserControllerType
    ) {
        self.authMiddleware = authMiddleware
        self.controller = userController
    }

    public func build(
        _ builder: RouteBuilder
    ) throws {
        // Get the base path group
        let path = builder.grouped("users")
        
        // Auth routes
        path.post(handler: controller.register)
        path.post("login", handler: controller.logIn)
        path.get("reset-password", "request", handler: controller.resetPasswordEmail)

        // Protected routes
        path.group(authMiddleware) { secured in
            secured.get("logout", handler: controller.logOut)
            secured.get("me", handler: controller.me)
            secured.patch("token", "regenerate", handler: controller.regenerate)
            secured.patch("update", handler: controller.update)
        }
    }
}
{'fraction_non_alphanumeric': 0.08994708994708994, 'fraction_numerical': 0.0, 'mean_word_length': 2.4930715935334873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '129128', 'n_tokens_mistral': 744, 'n_tokens_neox': 742, 'n_words': 217}