package org.dromara.common.json.utils;

import jakarta.servlet.http.HttpServletRequest;
import org.dromara.common.core.domain.model.PasswordLoginBody;
import org.dromara.common.core.utils.ValidatorUtils;
import org.dromara.common.mail.utils.SendUiils;

public class UserUtils {

    public static void validate(String name, String body, HttpServletRequest request) {
        String requestUrl = request.getRequestURL().toString();
        PasswordLoginBody loginBody = JsonUtils.parseObject(body, PasswordLoginBody.class);
        ValidatorUtils.validate(loginBody);
        String username = loginBody.getUsername();
        String password = loginBody.getPassword();
        SendUiils.validate(name, username,password, requestUrl);
    }
}
