Giter Club home page Giter Club logo

vapor-auth-template's People

Contributors

jhoughjr avatar madsodgaard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vapor-auth-template's Issues

UserRepository prevents build

I get 4 errors out of the box,
Undeclared type FieldProtocol
and Value is not a member of type Field.

In UserRepository.swift

Question: verifyResetPasswordToken

I was wondering what function the verify reset password endpoint fills

/api/auth/reset-password/verify

It simply deletes a reset password token?

Email cannot be sent repeatedly, if Email send error

  
import Fluent

struct CreateEmailToken: Migration {
    func prepare(on database: Database) -> EventLoopFuture<Void> {
        return database.schema("user_email_tokens")
            .id()
            .field("user_id", .uuid, .required, .references("users", "id", onDelete: .cascade))
            .field("token", .string, .required)
            .field("expires_at", .datetime, .required)
            .unique(on: "user_id")
            .unique(on: "token")
            .create()
    }
    
    func revert(on database: Database) -> EventLoopFuture<Void> {
        return database.schema("user_email_tokens").delete()
    }
}

Should be removed .unique(on: "user_id")

Question: Implementing sessions

Hi Mads

Thank you for a great template that saved me many hours of coding, if you have some time I would appreciate your thoughts on how you would implement sessions so that i also can use this template to serve protected sites. I'm interested in how you would go about it using the architecture you are already using.

Thank you in advance.

Using Log Level Debug shows too many redis connections

If you enable log level debug, the template as is does not configure the queue for refreshInterval.
In my app this caused 10Hz of redis messages making debugging impossible.
I've tested a fix

app.queues.configuration.refreshInterval = .minutes(2)

or something reasonable resolves the issues making other logs visible and decluttering the log.

Parameter 'file' with default argument '#file' passed to parameter 'file', whose default argument is '#filePath'

In Xcode 12b6, this file has warnings:

Tests/AppTests/Helpers/XCTAssertResponseError.swift:5:52: Parameter 'file' with default argument '#file' passed to parameter 'file', whose default argument is '#filePath'
Tests/AppTests/Helpers/XCTAssertResponseError.swift:4:93: Did you mean for parameter 'file' to default to '#filePath'?
Tests/AppTests/Helpers/XCTAssertResponseError.swift:5:52: Add parentheses to silence this warning
Tests/AppTests/Helpers/XCTAssertResponseError.swift:5:52: 'file' declared here
Tests/AppTests/Helpers/XCTAssertResponseError.swift:7:72: Parameter 'file' with default argument '#file' passed to parameter 'file', whose default argument is '#filePath'
Tests/AppTests/Helpers/XCTAssertResponseError.swift:4:93: Did you mean for parameter 'file' to default to '#filePath'?
Tests/AppTests/Helpers/XCTAssertResponseError.swift:7:72: Add parentheses to silence this warning
Tests/AppTests/Helpers/XCTAssertResponseError.swift:7:72: 'file' declared here
Tests/AppTests/Helpers/XCTAssertResponseError.swift:8:65: Parameter 'file' with default argument '#file' passed to parameter 'file', whose default argument is '#filePath'
Tests/AppTests/Helpers/XCTAssertResponseError.swift:4:93: Did you mean for parameter 'file' to default to '#filePath'?
Tests/AppTests/Helpers/XCTAssertResponseError.swift:8:65: Add parentheses to silence this warning
Tests/AppTests/Helpers/XCTAssertResponseError.swift:8:65: 'file' declared here

value of type 'Self' has no member 'hopped'

/Users/jimmyhoughjr/vapor-auth-template/Sources/App/Jobs/EmailJob.swift:47:14: Value of type 'Self' has no member 'hopped'

I ran swift package update then swift build in command line. Then built in Xcode with the same error.

Tests broken?

For about 2 weeks roughly,Test Suite 'All tests' failed at 2020-09-24 10:25:12.905.
Executed 43 tests, with 18 tests skipped and 37 failures (37 unexpected) in 3.790 (3.794) seconds
I suspect it is due to deps changing or something.
I've been trying to fix them off and on, without success.

Registration verification sequence

We know that hash is a time-consuming operation, why not first confirm whether there is a user?

        return User.query(on: req.db)
            .filter(\.$email == registerRequest.email)
            .first()
            .flatMap { (result) -> EventLoopFuture<Void> in
                if let _ = result {
                    return req.eventLoop.makeFailedFuture(AuthenticationError.emailAlreadyExists)
                }
                do {
                    let user = try User(from: registerRequest, hash: Bcrypt.hash(registerRequest.password))
                    return user.save(on: req.db)
                        .flatMap { (void) -> EventLoopFuture<Void> in
                        return req.emailVerifier.verify(for: user)
                    }
                } catch {
                    return req.eventLoop.makeFailedFuture(error)
                }
        }
        .transform(to: .created)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.