Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note #1

Open
takeshiemoto opened this issue Apr 23, 2023 · 0 comments
Open

Note #1

takeshiemoto opened this issue Apr 23, 2023 · 0 comments

Comments

@takeshiemoto
Copy link
Owner

takeshiemoto commented Apr 23, 2023

sequenceDiagram
    participant User
    participant Client
    participant Server
    participant Database
    participant EmailSystem

    User->>Client: Enter email and password
    Client->>Server: Send registration request
    Server->>Database: Save user, generate token and set expiration
    Database-->>Server: User and token saved
    Server->>EmailSystem: Send email with verification link
    EmailSystem-->>User: Verification email

    alt Email verification within expiry time
        User->>Client: Click verification link
        Client->>Server: Send token for verification
        Server->>Database: Validate token and update user
        Database-->>Server: User updated
        Server->>Client: Verification successful
        Client-->>User: Verification successful message
    else Email verification after expiry time
        User->>Client: Click verification link
        Client->>Server: Send token for verification
        Server->>Database: Check token expiry
        Database-->>Server: Token expired
        Server->>Client: Verification failed (token expired)
        Client-->>User: Verification failed message

        User->>Client: Request for re-registration
        Client->>Server: Send re-registration request
        Server->>Database: Check unverified user and generate new token
        Database-->>Server: New token and expiration created
        Server->>EmailSystem: Send new email with verification link
        EmailSystem-->>User: New verification email

        User->>Client: Click new verification link
        Client->>Server: Send new token for verification
        Server->>Database: Validate new token and update user
        Database-->>Server: User updated
        Server->>Client: Verification successful
        Client-->>User: Verification successful message
    end

Loading
SELECT * FROM email_verification_tokens
WHERE token = 'your_token' AND expiration > CURRENT_TIMESTAMP;
sqlx migrate add <name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant