console.log('register');

var register = document.getElementById("registerButton");

register.addEventListener('click', function () {
    let account = document.querySelector("#InputAccount").value;

    let repassword = document.querySelector("#RepeatPassword").value;
    let password = document.querySelector("#InputPassword").value;

    var data = {
        "username": account,
        "password": password,
    };



    if (repassword != password) {
        alert('密碼與確認密碼不相同')
        return
    }
    axios
        .post("https://cmm.ai:8080/auth/register", data)
        .then((response) => {
            console.log(response);
            alert(response.data.msg)
            //   history.go(0);
        })
        .catch((error) => console.log(error));








});


function validateEmail(email) {
    const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
    return re.test(email);
}