Public
Versions
- Open: VersionChanges from v10 to v11+11-2⦚ 32 unchanged lines ⦚`);
const existingUser = await sqlite.execute({sql: `SELECT * FROM ${TABLE_NAME} WHERE username = ?`,args: [username],});const bannedCharacters = [⦚ 54 unchanged lines ⦚}// User exists, verify passwordconst user = existingUser.rows[0];const storedPassword = user[2];⦚ 13 unchanged lines ⦚⦚ 32 unchanged lines ⦚`);// Check for existing userlet existingUser = await sqlite.execute({sql: `SELECT * FROM ${TABLE_NAME} WHERE username = ?`,args: [username],});// User not found with that username. Check if any banned users used to have that username.if (existingUser.rows.length === 0) {existingUser = await sqlite.execute({sql: `SELECT * FROM ${TABLE_NAME} WHERE pre_ban_username = ?`,args: [username],});}const bannedCharacters = [⦚ 54 unchanged lines ⦚}// User exists, verify password and check if bannedconst user = existingUser.rows[0];const storedPassword = user[2];⦚ 13 unchanged lines ⦚ - Open: VersionChanges from v9 to v10+5-0⦚ 98 unchanged lines ⦚const storedPassword = user[2];const passwordMatch = await bcrypt.compare(password, storedPassword);if (passwordMatch) {⦚ 5 unchanged lines ⦚⦚ 98 unchanged lines ⦚const storedPassword = user[2];const passwordMatch = await bcrypt.compare(password, storedPassword);const isBanned = user[5];if (isBanned) {return new Response(JSON.stringify({ error: "user is banned" }), { status: 401 });}if (passwordMatch) {⦚ 5 unchanged lines ⦚
- Open: VersionChanges from v8 to v9+1-1⦚ 27 unchanged lines ⦚password TEXT NOT NULL,status TEXT DEFAULT 'hello i am new',
last_updated DATETIME DEFAULT CURRENT_TIMESTAMPis_banned INTEGER DEFAULT 0)⦚ 75 unchanged lines ⦚⦚ 27 unchanged lines ⦚password TEXT NOT NULL,status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMP,is_banned INTEGER DEFAULT 0)⦚ 75 unchanged lines ⦚ - Open: VersionChanges from v7 to v8+1-1⦚ 28 unchanged lines ⦚status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMP
is_banned BOOLEAN DEFAULT 0)`);⦚ 74 unchanged lines ⦚⦚ 28 unchanged lines ⦚status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMPis_banned INTEGER DEFAULT 0)`);⦚ 74 unchanged lines ⦚ - Open: VersionChanges from v6 to v7+2-2⦚ 18 unchanged lines ⦚}
const TABLE_NAME = "lab_login_users_with_times";// Create users table if it doesn't exist⦚ 5 unchanged lines ⦚status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMPisbanned BOOLEAN DEFAULT FALSE)`);⦚ 74 unchanged lines ⦚⦚ 18 unchanged lines ⦚}const TABLE_NAME = "loginredux_users";// Create users table if it doesn't exist⦚ 5 unchanged lines ⦚status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMPis_banned BOOLEAN DEFAULT 0)`);⦚ 74 unchanged lines ⦚ - Open: VersionChanges from v5 to v6+1-1⦚ 18 unchanged lines ⦚}
const TABLE_NAME = "labloginredux_users";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚⦚ 18 unchanged lines ⦚}const TABLE_NAME = "lab_login_users_with_times";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚ - Open: VersionChanges from v4 to v5+1-1⦚ 18 unchanged lines ⦚}
const TABLE_NAME = "lab_login_users_with_times";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚⦚ 18 unchanged lines ⦚}const TABLE_NAME = "labloginredux_users";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚ - Open: VersionChanges from v3 to v4+1-1⦚ 18 unchanged lines ⦚}
const TABLE_NAME = "loginredux_users";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚⦚ 18 unchanged lines ⦚}const TABLE_NAME = "lab_login_users_with_times";// Create users table if it doesn't exist⦚ 84 unchanged lines ⦚ - Open: Version+107-0import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts";import { email } from "https://esm.town/v/std/email";import { sqlite } from "https://esm.town/v/std/sqlite";export default async function(req: Request): Promise<Response> {const body = await req.json();let { username, password } = body;if (!username || !password) {return new Response(JSON.stringify({ error: "Missing username or password" }), { status: 400 });}if (password.length > 50) {return new Response(JSON.stringify({ error: "Password too long" }), { status: 400 });}if (username.length > 50) {return new Response(JSON.stringify({ error: "Username too long" }), { status: 400 });}const TABLE_NAME = "loginredux_users";// Create users table if it doesn't existawait sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (id INTEGER PRIMARY KEY AUTOINCREMENT,username TEXT UNIQUE NOT NULL,password TEXT NOT NULL,status TEXT DEFAULT 'hello i am new',last_updated DATETIME DEFAULT CURRENT_TIMESTAMPisbanned BOOLEAN DEFAULT FALSE)`);const existingUser = await sqlite.execute({sql: `SELECT * FROM ${TABLE_NAME} WHERE username = ?`,
mittzy-loginredux_login.web.val.run
Updated: November 16, 2024