Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Navi-27/Proyecto-UPC/llms.txt

Use this file to discover all available pages before exploring further.

Registration is required to use the team builder (/equipo) and My Pokédex (/mi-pokedex) features. The app uses a simple username and password model — passwords are hashed via Werkzeug’s generate_password_hash, which defaults to the pbkdf2:sha256 algorithm. Accounts are stored locally in an SQLite database (pokedex.db) and no email address is required to sign up.

Registration Flow

1

Navigate to /registro

Open /registro in your browser, or click the Register link on the login page (¿No tienes cuenta? Regístrate aquí). The page renders the Crear Cuenta form.
2

Fill in your credentials

Enter a unique username and a password in the two form fields. Both fields are required — the form will not submit if either is left blank.
3

Submit the form

Click Registrarse. The server handles the POST /registro request and calls Usuario.crear(username, password), which performs three operations:
  • Hashes the password with werkzeug.security.generate_password_hash (no plain-text password ever touches the database).
  • Executes INSERT INTO usuarios (username, password) VALUES (?, ?) against the SQLite usuarios table.
  • Returns True on a successful insert, or False if the username already exists (caught by the UNIQUE constraint on usuarios.username).
@staticmethod
def crear(username, password):
    conn = get_connection()
    try:
        conn.execute(
            "INSERT INTO usuarios (username, password) VALUES (?,?)",
            (username, generate_password_hash(password))
        )
        conn.commit()
        return True
    except:
        return False
    finally:
        conn.close()
4

Success — redirected to /login

When Usuario.crear returns True, the server flashes the message “registro exitoso, ya puedes iniciar sesion” (category: success) and issues a 302 redirect to /login. You can now sign in with the credentials you just created.
5

Failure — username already taken

When Usuario.crear returns False (the username is already registered), the server flashes the message “El usuario ya existe” (category: Error) and re-renders the /registro page with the form still open so you can try a different username.

Username Requirements

RuleDetail
UniquenessEvery username must be unique across all registered accounts. This is enforced by a UNIQUE constraint on the usuarios.username column at the database level.
LengthNo minimum or maximum length is enforced by the application — the underlying TEXT NOT NULL column type imposes no practical limit.
CharactersAny character accepted by SQLite TEXT is allowed.
Usernames are case-sensitive. Ash, ash, and ASH are treated as three distinct accounts.

Password Security

Passwords are never stored in plain text. The werkzeug.security.generate_password_hash function is called at registration time and produces a hash in the format:
pbkdf2:sha256:<iterations>$<salt>$<hash>
Only this hashed string is written to the usuarios table. At login, check_password_hash re-derives the hash from the supplied password and compares it to the stored value — the original password is never recoverable from the database.

Database Schema Reference

The usuarios table that backs registration is created by models/database.py on first run:
CREATE TABLE IF NOT EXISTS usuarios (
    id       INTEGER PRIMARY KEY AUTOINCREMENT,
    username TEXT    NOT NULL UNIQUE,
    password TEXT    NOT NULL
);
Each registered account gets an auto-incremented integer id that is used as a foreign key in the equipos and pokedex_usuario tables.

Build docs developers (and LLMs) love