diff --git a/api/checkUpdate.php b/api/checkUpdate.php
new file mode 100644
index 0000000..3285aa5
--- /dev/null
+++ b/api/checkUpdate.php
@@ -0,0 +1,69 @@
+ $val){
+ $redis->hSet('session/dialog/'.$hash, $key, $val);
+ }
+}
+
+
+$redis = new redis();
+$redis->connect('redis',6379);
+
+
+$hash = $_REQUEST['hash'];
+$nickname = $_REQUEST['nickname'];
+$thash = $_REQUEST['thash'];
+
+if(!isset($hash)) die();
+
+$cnn = db__connect();
+if(!db__rowNum($cnn, "account", "hash", $hash)){
+ echo json_encode(array("code"=> 500, "message"=>"Illegal hash!!"));
+ die();
+}
+
+if(isset($nickname)){
+
+ db__pushData($cnn, "account", array("nickname"=>$nickname), array("hash"=>$hash));
+ updateSession($cnn, $hash);
+ echo json_encode(array("code"=> 200, "message" => "Update successfully!"));
+ die();
+}
+
+if(!isset($thash)) die();
+
+if($redis->exists('account/'.$thash)){
+
+ $arr = json_decode($redis->get('account/'.$thash), true);
+
+ if($arr['isExist']){
+ echo json_encode(array("code"=> 500, "message"=>"This tel / email had been occupied!!"));
+ die();
+ }
+
+
+ $info = array();
+ if($arr["tel"]){
+ $info = array("tel"=>$arr["tel"]);
+ }
+ if($arr["email"]){
+ $info = array("email"=>$arr["email"]);
+ }
+ if($arr["nickname"]){
+ $info = array("nickname"=>$arr["nickname"]);
+ }
+
+ db__pushData($cnn, "account", $info, array("hash"=>$hash));
+ updateSession($cnn, $hash);
+ echo json_encode(array("code"=> 200, "message" => "Update successfully!"));
+
+}else{
+ echo json_encode(array("code"=> 500, "message"=>"Error!!"));
+}
+
+
diff --git a/getpass.html b/getpass.html
deleted file mode 100644
index 53b820b..0000000
--- a/getpass.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
- 找回密码
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/index.html b/index.html
index 8c07f9c..d8c3cdd 100644
--- a/index.html
+++ b/index.html
@@ -1,100 +1,48 @@
-
+
Ushio Login
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/js/login.js b/js/login.js
index 89fd327..0809b1f 100644
--- a/js/login.js
+++ b/js/login.js
@@ -28,6 +28,23 @@ $(function(){
});
+ if(page.params.hasOwnProperty('require')){
+ if(page.params.require == 'tel'){
+ $('.tel-warn').addClass('hide');
+ tab = $(".message").attr('class').split(' ')[0];
+ checkBtn();
+ $(".message").addClass("on");
+ $(".account_number").removeClass("on");
+ $("#num").addClass("hide");
+ $("#num2").removeClass("hide");
+ $("#lab_num").html('手机号');
+ $('.change-login').hide();
+ }
+ if(page.params.require == 'email'){
+ $('.change-login').hide();
+ }
+ }
+
$('#num').keyup(function(event) {
$('.tel-warn').addClass('hide');
checkBtn();
@@ -172,7 +189,7 @@ $(function(){
window.location.href="https://auth.yimian.xyz/setToken.php?token="+data.token+"&from="+to;
}else{
tips.warning({message: '登录/注册失败!'})
- window.location.reload();
+ setTimeout(()=>{window.location.reload()}, 2000);
}
});
});
diff --git a/js/update.js b/js/update.js
new file mode 100644
index 0000000..eab82cf
--- /dev/null
+++ b/js/update.js
@@ -0,0 +1,274 @@
+$(function(){
+ var tab = 'account_number';
+ var usr = '';
+ var code = '';
+ var hash = '';
+ var timer;
+ // 选项卡切换
+ $(".account_number").click(function () {
+ $('.tel-warn').addClass('hide');
+ tab = $(this).attr('class').split(' ')[0];
+ checkBtn();
+ $(this).addClass("on");
+ $(".message").removeClass("on");
+ $("#num2").addClass("hide");
+ $("#num").removeClass("hide");
+ $("#lab_num").html('邮箱');
+ });
+ // 选项卡切换
+ $(".message").click(function () {
+ $('.tel-warn').addClass('hide');
+ tab = $(this).attr('class').split(' ')[0];
+ checkBtn();
+ $(this).addClass("on");
+ $(".account_number").removeClass("on");
+ $("#num").addClass("hide");
+ $("#num2").removeClass("hide");
+ $("#lab_num").html('手机号');
+
+ });
+
+ if(page.params.hasOwnProperty('require')){
+ if(page.params.require == 'tel'){
+ $('.tel-warn').addClass('hide');
+ tab = $(".message").attr('class').split(' ')[0];
+ checkBtn();
+ $(".message").addClass("on");
+ $(".account_number").removeClass("on");
+ $("#num").addClass("hide");
+ $("#num2").removeClass("hide");
+ $("#lab_num").html('手机号');
+ $('.change-login').hide();
+ }
+ session.onload(function(){
+ if(!session.get('hash')){
+ window.location.href = '/login.html?require='+page.params.require;
+ }
+ });
+ }else{
+ session.onload(function(){
+ if(!session.get('hash')){
+ window.location.href = '/login.html';
+ }
+ });
+ }
+ $('.change-login').hide();
+
+ $('#num').keyup(function(event) {
+ $('.tel-warn').addClass('hide');
+ checkBtn();
+ });
+
+ $('#pass').keyup(function(event) {
+ $('.tel-warn').addClass('hide');
+ checkBtn();
+ });
+
+ $('#veri').keyup(function(event) {
+ $('.tel-warn').addClass('hide');
+ checkBtn();
+ });
+
+ $('#num2').keyup(function(event) {
+ $('.tel-warn').addClass('hide');
+ checkBtn();
+ });
+
+ $('#veri-code').keyup(function(event) {
+ $('.tel-warn').addClass('hide');
+ checkCode($('#veri-code').val());
+ });
+
+ // 按钮是否可点击
+ function checkBtn()
+ {
+
+ $(".log-btn").off('click').addClass("off");
+ }
+
+ $('.z').click(function(){
+
+ if(($('#agree').val() == "1") && hash.length){
+ sendBtn();
+ }else{
+ checkBtn();
+ }
+ });
+
+
+ function checkTo(phone){
+ if(tab == 'account_number'){
+
+ var status = true;
+ if (phone == '') {
+ $('.num-err').removeClass('hide').find("em").text('请输入邮箱');
+ return false;
+ }
+ var param = /^([A-Za-z0-9_\-\.\u4e00-\u9fa5])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,8})$/;
+ if (!param.test(phone)) {
+ // globalTip({'msg':'手机号不合法,请重新输入','setTime':3});
+ $('.num-err').removeClass('hide');
+ $('.num-err').text('邮箱不合法,请重新输入');
+ return false;
+ }
+ }else{
+
+
+ var status = true;
+ if (phone == '') {
+ $('.num-err').removeClass('hide').find("em").text('请输入手机号');
+ return false;
+ }
+ var param = /^1[34578]\d{9}$/;
+ if (!param.test(phone)) {
+ // globalTip({'msg':'手机号不合法,请重新输入','setTime':3});
+ $('.num-err').removeClass('hide');
+ $('.num-err').text('手机号不合法,请重新输入');
+ return false;
+ }
+
+ }
+
+ usr = phone;
+ return status;
+ }
+
+ function checkCode(pCode){
+ checkBtn();
+ if (pCode == '') {
+ $('.error').removeClass('hide').text('请输入验证码');
+ return false;
+ } else if(pCode.length ==6){
+ $('.error').addClass('hide');
+
+ code = pCode;
+ $.get('/api/verCode.php?type='+((tab == 'account_number')?'email':'tel')+'&usr='+usr+'&code='+code, function(data){
+ data = JSON.parse(data);
+ if(data.code == 200){
+
+ hash = data.hash;
+ var oTime = $(".form-data .time"),
+ oSend = $(".form-data .send"),
+ oEm = $(".form-data .time em");
+ clearInterval(timer);
+ oSend.text("验证成功");
+ oSend.css("color", 'green');
+ oSend.show();
+ oEm.text("120");
+ oTime.addClass("hide");
+ sendBtn();
+ $('.error').addClass('hide')
+ }else{
+ $('.error').removeClass('hide').text('验证码错误!');
+ checkBtn();
+ }
+
+ });
+
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+
+
+ // 登录点击事件
+ function sendBtn(){
+
+
+ if(!(($('#agree').val() == "1") && hash.length)) return;
+
+ $(".log-btn").removeClass("off");
+ $('.log-btn').click(function(){
+ session.onload(function(){
+ $.get('/api/checkUpdate.php?thash='+hash+'&hash='session.get('hash'), function(data){
+ data = JSON.parse(data);
+ if(data.code == 200){
+ tips.success({message: '更新成功!'});
+ var to = 'https://www.eee.dog/';
+ if(cookie.get('_from')){
+ to = decodeURI(cookie.get('_from'));
+ cookie.del('_from');
+ }
+ window.location.href=to;
+ }else{
+ tips.warning({message: data.message});
+ setTimeout(()=>{window.location.reload()}, 2000);
+ }
+ });
+ });
+ });
+ }
+
+ // 登录的回车事件
+ $(window).keydown(function(event) {
+ if (event.keyCode == 13) {
+ $('.log-btn').trigger('click');
+ }
+ });
+
+
+ $(".form-data").delegate(".send","click",function () {
+
+ if(tab == 'account_number'){
+ var to = $.trim($('#num').val());
+ }else{
+ var to = $.trim($('#num2').val());
+ }
+
+
+ if (checkTo(to)) {
+ var oTime = $(".form-data .time"),
+ oSend = $(".form-data .send"),
+ num = parseInt(oTime.text()),
+ oEm = $(".form-data .time em");
+ $(this).hide();
+ oTime.removeClass("hide");
+ timer = setInterval(function () {
+ var num2 = num-=1;
+ oEm.text(num2);
+ if(num2==0){
+ clearInterval(timer);
+ oSend.css("color", 'red');
+ oSend.show();
+ oEm.text("120");
+ oTime.addClass("hide");
+ }
+ },1000);
+
+ $.ajax({
+ url: '/api/'+((tab == 'account_number')?'email':'sms')+'Code.php',
+ type: 'get',
+ dataType: 'json',
+ async: true,
+ data: {email: to, tel: to},
+ success:function(data){
+ data = JSON.parse(data);
+ if (data.code == '200') {
+
+ } else {
+ clearInterval(timer);
+ oSend.text("重新发送验证码");
+ oSend.css("color", 'red');
+ oSend.show();
+ oEm.text("120");
+ oTime.addClass("hide");
+ }
+ },
+ error:function(){
+ clearInterval(timer);
+ oSend.text("重新发送验证码");
+ oSend.css("color", 'red');
+ oSend.show();
+ oEm.text("120");
+ oTime.addClass("hide");
+ }
+ });
+
+ }
+ });
+
+
+
+});
diff --git a/login.html b/login.html
new file mode 100644
index 0000000..bbcbe75
--- /dev/null
+++ b/login.html
@@ -0,0 +1,101 @@
+
+
+
+
+ Ushio Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/setNickname.html b/setNickname.html
new file mode 100644
index 0000000..5ecc351
--- /dev/null
+++ b/setNickname.html
@@ -0,0 +1,118 @@
+
+
+
+
+ Ushio Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/update.html b/update.html
new file mode 100644
index 0000000..c604203
--- /dev/null
+++ b/update.html
@@ -0,0 +1,91 @@
+
+
+
+
+ Ushio Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+