apeblog/public/template/default/pc/login/register.html

152 lines
6.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh">
<head>
<title>{:web_config('title')}-注册页</title>
<meta name="keywords" content="{:web_config('keywords')}">
<meta name="description" content="{:web_config('description')}">
{include file="public/head" /}
<link rel="stylesheet" href="__LIB__/swiper/swiper.min.css"/>
<script type="text/javascript" src="__LIB__/swiper/swiper.min.js"></script>
</head>
<body>
<link rel="stylesheet" href="__CSS__/login-plane.css">
<div id="app" class="login-background">
{include file="public/header" /}
<div class="header-zhanwei" style="min-height: 80px; width: 100%"></div>
<style>
#app {
background-image: url(__IMG__/login_backgroud.jpg);
}
</style>
<main class="container">
<div id="login-plane">
<div class="login-main">
<div id="login-note">
提示
</div>
<div class="login-form">
<div class="login-title">
<h3>注册用户</h3>
</div>
<i class="fas fa-user ico-login" aria-hidden="true"></i>
<input class="input-login input-user" name="username" type="text" placeholder="用户名(只能英文)">
<i class="far fa-envelope ico-login" aria-hidden="true"></i>
<input class="input-login input-pass" name="email" type="text" placeholder="电子邮箱">
<i class="fas fa-key ico-login" aria-hidden="true"></i>
<input class="input-login input-pass" name="password" type="text" placeholder="密码">
<i class="fas fa-key ico-login" aria-hidden="true"></i>
<input class="input-login input-pass" name="repassword" type="text" placeholder="重复密码">
<div class="code-plane">
<img class="img-code" src="/index/login/captcha" alt="">
<input class="input-login input-code" name="captcha" type="text" placeholder="验证码">
</div>
<div class="login-title">
<div>已有账户?</div>
<a href="/index/login/login">立即登录</a>
</div>
<div>
<button class="login-button" id="btn-login">注册账户</button>
</div>
<div class="usercenter-info-text">
<p><b>注册须知:</b>
</p>
<p>用户名只支持英文用户名</p>
<p>密码不能包含中文长度8位以上并且必须包含中英文和数字</p>
</div>
</div>
</div>
</div>
</main>
<script>
$('.img-code').click(() => {
recodeimg();
});
function recodeimg() {
$('.img-code').attr('src', "/index/login/captcha?d=" + Math.random());
}
$('input[name="repassword"],input[name="username"],input[name="email"]').click(function () {
$(this).removeClass('input-warning');
});
$('#btn-login').click(() => {
var username = $('input[name="username"]').val();
var email = $('input[name="email"]').val();
var password = $('input[name="password"]').val();
var repassword = $('input[name="repassword"]').val();
var captcha = $('input[name="captcha"]').val();
if (password != repassword) {
$('input[name="repassword"]').addClass('input-warning')
$('#login-note').text('两次密码输入不一致');
$('#login-note').css('visibility', 'visible');
setTimeout(function () {
$('#login-note').css('visibility', 'hidden');
}, 3000);
return;
}
if (username == '' || password == '' || repassword == '' || email == '') {
return;
}
if (!checkEemail(email)) {
$('#login-note').text('邮箱格式不正确');
$('#login-note').css('visibility', 'visible');
$('input[name="email"]').addClass('input-warning')
setTimeout(function () {
$('#login-note').css('visibility', 'hidden');
}, 3000);
return;
}
if (isChinese(password) || isChinese(username)) {
addarelt('密码和用户名不支持中文', 'erro');
return;
}
if (!haveNumandLetter(password)) {
addarelt('密码必须包含字母和数字', 'erro');
return;
}
if (password.length < 8) {
addarelt('密码必须大于8位', 'erro');
return;
}
$('#login-note').text('正在注册,请稍后');
$('#login-note').css('visibility', 'visible');
$.post('/index/login/login', {
action: 'corepress_reguser',
user: user,
email: email,
password: password,
captcha: captcha
}, (data) => {
var obj = JSON.parse(data);
if (obj) {
if (obj.code === 1) {
$('#login-note').text('注册成功,跳转登陆页面');
window.location.href = 'https://www.cnesa.cn/login';
} else if (obj.code === 2) {
$('#login-note').text(obj.msg);
} else if (obj.code === 0) {
$('#login-note').text(obj.msg);
recodeimg();
}
}
});
});
function checkEmail(email) {
var myreg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
if (!myreg.test(email)) {
return false;
} else {
return true;
}
}
</script>
{include file="public/footer"/}
</div>
</body>
</html>