Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:A616567126 GPT WEB JAVA User Registration

From Leeroopedia
Knowledge Sources
Domains Authentication, User_Management
Last Updated 2026-10-13 00:00 GMT

Overview

Technique that supports multiple user registration methods (temporary fingerprint-based, password/mobile, email verification, WeChat binding) with MD5 password hashing and temporary-to-permanent user upgrade.

Description

User registration in this platform supports multiple pathways:

  • Temporary user: Created on first visit using a browser fingerprint + MD5 auth token. Gets default credits (type=2). Can be upgraded to a registered user later.
  • Password registration: Mobile + password, verified by MD5 hashing. Requires registrationMethod == 1.
  • Email registration: Mobile + email + verification code. Code validated from Redis. Requires registrationMethod == 2.
  • WeChat registration: User sends "开通-手机号" to the WeChat bot, creating a type=1 user with the WeChat openid as fromUserName.

All passwords are hashed with MD5 via SecureUtil.md5(). Temporary users are identified by fingerprint and IP address, allowing session continuity before formal registration.

Usage

Use this principle when:

  • Supporting anonymous trial users before requiring registration
  • Offering multiple registration methods (password, email, social)
  • Needing to upgrade temporary users to permanent accounts with data preservation

Theoretical Basis

Registration Methods:

# Abstract algorithm (NOT real implementation)
def register_temp(fingerprint, auth_token):
    if md5(fingerprint + "Siana") != auth_token:
        raise AuthError()
    user = find_temp_user(fingerprint, ip)
    if user is None:
        user = create_user(type=TEMP, credits=DEFAULT, fingerprint=fingerprint)
    return create_token(user)

def register_password(mobile, password, name):
    if registration_method != PASSWORD:
        raise NotEnabledError()
    if user_exists(mobile):
        raise DuplicateError()
    user = create_user(type=REGULAR, mobile=mobile, password=md5(password))
    save(user)

def register_email(mobile, email, code, password):
    if registration_method != EMAIL:
        raise NotEnabledError()
    if redis.get("email_code:" + email) != code:
        raise InvalidCodeError()
    save_user(mobile, email, md5(password))

Key Properties:

  • Fingerprint auth: MD5(fingerprint + "Siana") as auth token for temp users
  • IP limit: Max 1 temp user per IP address (prevents abuse)
  • Temp upgrade: Temporary users (type=2) are upgraded to type=1 when they register, preserving their ID and credits
  • Email code: Verification code stored in Redis with TTL
  • MD5 hashing: All passwords hashed with SecureUtil.md5()

Practical Guide

The repository implements this in AuthController:

  1. createImage() — temp user creation (name is misleading; creates user, not image)
  2. register() — password registration, requires registrationMethod == 1
  3. registerEmail() — email registration with Redis-validated code, requires registrationMethod == 2
  4. saveUser() — core logic: checks for existing temp user by fingerprint, creates new or upgrades existing
  5. userLogin() — validates mobile + MD5(password), checks WeChat binding if registrationMethod == 3
  6. createLoginResult() — builds UserAuthRes with JWT token after registration/login

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment