Principle:A616567126 GPT WEB JAVA User Registration
| 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:
createImage()— temp user creation (name is misleading; creates user, not image)register()— password registration, requiresregistrationMethod == 1registerEmail()— email registration with Redis-validated code, requiresregistrationMethod == 2saveUser()— core logic: checks for existing temp user by fingerprint, creates new or upgrades existinguserLogin()— validates mobile + MD5(password), checks WeChat binding ifregistrationMethod == 3createLoginResult()— buildsUserAuthReswith JWT token after registration/login