package com.example.myapplication.service;

public class RegistrationService {
    public static String validateRegistration(String username, String password, String confirm) {
        if (username == null || password == null || confirm == null) return "请输入完整信息";
        username = username.trim();
        password = password.trim();
        confirm = confirm.trim();
        if (username.length() < 3 || username.length() > 20) {
            return "用户名长度应为3-20个字符";
        }
        if (password.length() < 6) {
            return "密码长度不能少于6位";
        }
        if (!password.equals(confirm)) {
            return "两次输入的密码不一致";
        }
        return null; // null 表示校验通过
    }
}