GeneratePasswordResetTokenCommand - ml-archive/reset GitHub Wiki
Generates password reset tokens for a user which can be used to reset their password.
public struct GeneratePasswordResetTokenCommand<U: PasswordResettable>: Command
Command
GeneratePasswordResetTokenCommand.GeneratePasswordResetTokenCommand.Keys
Creates a new password reset token command with a custom lookup strategy.
public init(databaseIdentifier: DatabaseIdentifier<U.Database>, makeFilter: @escaping (String) -> FilterOperator<U.Database, U>, context: U.Context = U.Context.requestResetPassword())
Example to enable search by email:
GeneratePasswordResetTokenCommand(databaseIdentifier: .mysql) { query in
try \User.email == $0
}
- databaseIdentifier: identifier of database from where to load the user.
- makeFilter: used to create the filter from the query.
- context: The Reset context to use when generating the token.
See Command
let arguments: [CommandArgument] = [.argument(name: Keys.query)]
See CommandRunnable
let help = ["Generates a password reset token for a user with a given id."]
See CommandRunnable
let options: [CommandOption] = []
See CommandRunnable
public func run(using context: CommandContext) throws -> Future<Void>