Merge branch 'pr/9' into dev

king_uim
GeekQu 8 years ago
commit dcd6d5dfd1

@ -90,10 +90,6 @@ Wiki已经启用,欢迎为此面板维护wiki
您对我们的帮助将是支持我们做下去的动力,只需您在购买部分产品或向他人推荐产品时从我们的返利链接购买,这就是对我们很大的支持了。~~没有钱了,肯定要做啊,不做没有钱用啊,打工是不可能打工的,这辈子不可能打工的~~
**NimaQu**
- [TrimePay 签约](https://portal.trimepay.com/#/auth/register/134)
- [Scorpioud - 圣何塞大带宽/波特兰高防 VPS](https://www.scorpioud.com)
##### dumplin
@ -105,7 +101,7 @@ Wiki已经启用,欢迎为此面板维护wiki
- [冲上云霄云主机](http://console.soar-clouds.com/aff.php?aff=94)
- [Vultr](https://www.vultr.com/?ref=7205737)
[Nymph 的前端课程报名](t.me/kinokonominoco)
[laurieryayoi 的前端课程报名](https://t.me/kinokonominoco)

@ -526,8 +526,8 @@ class AuthController extends BaseController
public function qrcode_check($request, $response, $args)
{
$token = $request->getQueryParams()["token"];
$number = $request->getQueryParams()["number"];
$token = $request->getParam('token');
$number = $request->getParam('number');
if (Config::get('enable_telegram') == 'true') {
$ret = TelegramSessionManager::check_login_session($token, $number);

@ -21,6 +21,8 @@ use App\Utils\TelegramProcess;
use App\Utils\Spay_tool;
use App\Utils\Geetest;
use voku\helper\AntiXSS;
class VueController extends BaseController {
private $user;
@ -64,7 +66,7 @@ class VueController extends BaseController {
"telegram_bot" => Config::get('telegram_bot'),
"enable_logincaptcha" => Config::get('enable_login_captcha'),
"enable_regcaptcha" => Config::get('enable_reg_captcha'),
"base_url" => Config::get('enable_reg_captcha'),
"base_url" => Config::get('baseUrl'),
"recaptcha_sitekey" => $recaptcha_sitekey,
"captcha_provider" => Config::get('captcha_provider'),
"jump_delay" => Config::get('jump_delay'),
@ -73,6 +75,8 @@ class VueController extends BaseController {
"appName" => Config::get('appName'),
"dateY" => date("Y"),
"isLogin" => $user->isLogin,
"enable_telegram" => Config::get('enable_telegram'),
"enable_crisp" => Config::get('enable_crisp'),
);
$res['ret'] = 1;

@ -115,7 +115,7 @@ $System_Config['account_expire_delete_days']='-1'; //账户到期几天之后
$System_Config['enable_kill']='true'; //是否允许用户注销账户
$System_Config['notify_limit_mode'] = 'false'; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$System_Config['notify_limit_value'] = '20'; //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
$System_Config['mergeSub'] = false; //合并订阅设置 可选项 false / true
$System_Config['mergeSub'] = 'false'; //合并订阅设置 可选项 false / true
//Telegram bot设置------------------------------------------------------------------------------------

@ -178,7 +178,7 @@ $app->group('/payment', function () {
// Auth
$app->group('/auth', function () {
$this->get('/login', 'App\Controllers\AuthController:login');
$this->get('/qrcode_check', 'App\Controllers\AuthController:qrcode_check');
$this->post('/qrcode_check', 'App\Controllers\AuthController:qrcode_check');
$this->post('/login', 'App\Controllers\AuthController:loginHandle');
$this->post('/qrcode_login', 'App\Controllers\AuthController:qrcode_loginHandle');
$this->get('/register', 'App\Controllers\AuthController:register');

@ -19,6 +19,10 @@ a {
justify-content: space-around;
}
.space-between {
justify-content: space-between;
}
.align-center {
align-items: center;
}
@ -27,6 +31,10 @@ a {
flex-wrap: wrap;
}
.text-left {
text-align: left;
}
[v-cloak] {
display: none;
}
@ -39,6 +47,7 @@ a {
.loading {
position: fixed;
top: 0;
text-align: center;
width: 100%;
height: 100%;
@ -94,6 +103,7 @@ a {
.main {
text-align: center;
min-height: 80vh;
padding: 1.5rem 0 2.5rem 0;
}
.title,
@ -193,7 +203,7 @@ input.checkbox {
border: 1px solid transparent;
min-height: 46px;
margin-top: 1rem;
width: 32%;
width: 81%;
}
.auth-submit:hover,
@ -210,6 +220,11 @@ input.checkbox {
.auth h1 {
font-size: 3.5rem;
margin-top: 0;
}
.auth h3 {
margin: 0;
}
.page-auth,
@ -219,6 +234,10 @@ input.checkbox {
position: relative;
}
.page-auth {
min-height: 450px;
}
.input-control {
justify-content: center;
flex-wrap: wrap;
@ -278,10 +297,17 @@ select {
justify-content: flex-start;
align-items: center;
margin-bottom: 1rem;
color: white;
opacity: .5;
}
.button-round .fa-inverse {
color: black;
}
.button-round .fa-stack {
margin-right: .4rem;
}
.button-round:hover,
.button-round:focus {
opacity: 1;
@ -295,23 +321,8 @@ select {
height: 2rem;
display: inline-block;
margin-right: .75rem;
}
.fa {
position: relative;
}
.icon-round .fa-pencil {
top: .25rem;
left: .05rem
}
.icon-round .fa-plus {
top: .35em;
}
.icon-round .fa-gear {
top: .3rem;
line-height: 2rem;
padding-left: .1rem;
}
#embed-captcha-reg {
@ -330,7 +341,57 @@ select {
font-weight: bolder;
}
.basis-max .input-control {
width: 100%;
}
.basis-max .auth-submit {
width: 80%;
}
#code_number,
.tg-timeout {
padding: .6rem 1rem;
width: 100%;
font-size: 1.3em;
}
.auth-submit.tg-timeout {
width: 80%;
}
.qr-center img {
width: 70%;
height: 70%;
text-align: center;
}
#register {
margin-top: 2rem;
}
#embed-captcha-reg {
min-height: 44px;
}
#embed-captcha-reg .geetest_btn {
margin-left: auto;
margin-right: auto;
width: 87%;
}
.auth-tg {
margin-top: 2rem;
}
.auth-tg p {
padding: 0 2rem;
}
.auth-tg p a {
color: #D1335B;
}
@media screen and (min-width:35.5em) {
.auth-tg {
margin-top: 0;
}
.auth-sm a {
min-width: 120px;
}
@ -361,6 +422,10 @@ select {
text-align: right;
}
.auth-submit {
width: 32%;
}
.auth-links {
padding: 0;
}
@ -376,6 +441,14 @@ select {
.auth>div:first-of-type {
padding: 0 0 0 5%;
}
.usrcenter {
padding: 0 5rem;
}
.enableCrisp {
padding-right: 3rem;
}
}
@media screen and (min-width:48em) {
@ -383,10 +456,6 @@ select {
font-size: 5rem;
}
#register {
margin-top: 2rem;
}
.twin {
justify-content: space-around;
align-items: flex-end;
@ -547,4 +616,55 @@ input[type=checkbox].uim-checkbox {
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
}
}
.spinnercube {
margin: 100px auto;
width: 32px;
height: 32px;
position: relative;
transition: all .3s;
}
.cube1, .cube2 {
background-color: white;
width: 30px;
height: 30px;
position: absolute;
top: 0;
left: 0;
-webkit-animation: cubemove 1.8s infinite ease-in-out;
animation: cubemove 1.8s infinite ease-in-out;
}
.cube2 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
@-webkit-keyframes cubemove {
25% { -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) }
50% { -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) }
75% { -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) }
100% { -webkit-transform: rotate(-360deg) }
}
@keyframes cubemove {
25% {
transform: translateX(42px) rotate(-90deg) scale(0.5);
-webkit-transform: translateX(42px) rotate(-90deg) scale(0.5);
} 50% {
transform: translateX(42px) translateY(42px) rotate(-179deg);
-webkit-transform: translateX(42px) translateY(42px) rotate(-179deg);
} 50.1% {
transform: translateX(42px) translateY(42px) rotate(-180deg);
-webkit-transform: translateX(42px) translateY(42px) rotate(-180deg);
} 75% {
transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5);
-webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5);
} 100% {
transform: rotate(-360deg);
-webkit-transform: rotate(-360deg);
}
}

@ -243,7 +243,7 @@
);
function f() {
$.ajax({
type: "GET",
type: "POST",
url: "qrcode_check",
dataType: "json",
data: {

@ -7,24 +7,37 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content=""/>
<meta name="description" content=""/>
<title>{$config["appName"]}</title>
<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="bookmark" href="/favicon.ico"/>
<title>{$config["appName"]}</title>
<link rel="stylesheet" href="/theme/material/css/index_base.css">
<link rel="stylesheet" href="/theme/material/css/index.css">
{if $config["enable_crisp"] == 'true'}
<literal><script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="{$config["crisp_id"]}";
$crisp.push(["set", "user:email", "{$user->email}"]);
$crisp.push(["config", "color:theme", "grey"]);
(function(){ d=document;s=d.createElement("script"); s.src="https://client.crisp.chat/l.js"; s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();
</script></literal>
{/if}
</head>
<style>
.slide-fade-enter-active,.fade-enter-active,.loading-fade-enter-active,.rotate-fade-enter-active {
.slide-fade-enter-active,.fade-enter-active,.loading-fade-enter-active,.rotate-fade-enter-active,.loading-fadex-enter-active {
transition: all .3s ease;
}
.slide-fade-leave-active,.fade-leave-active,.loading-fade-leave-active,.rotate-fade-leave-active {
.slide-fade-leave-active,.fade-leave-active,.loading-fade-leave-active,.rotate-fade-leave-active,.loading-fadex-leave-active {
transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.loading-fade-enter {
transform: scaleY(.75);
opacity: 0;
}
.loading-fadex-enter {
transform: scaleX(.75);
opacity: 0;
}
.slide-fade-enter {
transform: translateY(-20px);
opacity: 0;
@ -43,7 +56,7 @@
-webkit-transform: rotateY(90deg);
opacity: 0;
}
.fade-enter,.fade-leave-to {
.fade-enter,.fade-leave-to,.loading-fade-leave-to,.loading-fadex-leave-to {
opacity: 0;
}
</style>
@ -85,7 +98,7 @@
</div>
<div class="footer pure-g">
<div class="pure-u-1 pure-u-sm-1-2 staff">POWERED BY <a href="./staff">SSPANEL-UIM</a></div>
<div class="pure-u-1 pure-u-sm-1-2 time">&copy;$[globalConfig.indexMsg.date]$ $[globalConfig.indexMsg.appname]$</div>
<div class="pure-u-1 pure-u-sm-1-2 time" :class="{ enableCrisp:globalConfig.crisp === 'true' }">&copy;$[globalConfig.indexMsg.date]$ $[globalConfig.indexMsg.appname]$</div>
</div>
<transition name="slide-fade" mode="out-in">
@ -101,20 +114,87 @@
{if $recaptcha_sitekey != null}
<script src="https://recaptcha.net/recaptcha/api.js?render=explicit" async defer></script>
{/if}
<script src="/theme/material/js/vue.min.js"></script>
<script src="/theme/material/js/vuex.min.js"></script>
<script src="/theme/material/js/vue-router.min.js"></script>
<script src="/theme/material/js/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21"></script>
<script src="https://cdn.jsdelivr.net/npm/vuex@3.0.1/dist/vuex.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.2"></script>
{if isset($geetest_html)}
<script src="//static.geetest.com/static/tools/gt.js"></script>
{/if}
{if $config['enable_telegram'] == 'true'}
<script src="https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js"></script>
{/if}
</body>
</html>
<script>
{*/**
* A wrapper of window.Fetch API
* @author Sukka (https://skk.moe)
/**
* A Request Helper of Fetch
* @function _request
* @param {string} url
* @param {string} body
* @param {string} method
* @returns {function} - A Promise Object
*/*}
const _request = (url, body, method) =>
fetch(url, {
method: method,
body: body,
headers: {
'content-type': 'application/json'
}
}).then(resp => {
return Promise.all([resp.ok, resp.status, resp.json()]);
}).then(([ok, status, json]) => {
if (ok) {
return json;
} else {
throw new Error(JSON.stringify(json.error));
}
}).catch(error => {
throw error;
});
{*/**
* A Wrapper of Fetch GET Method
* @function _get
* @param {string} url
* @returns {function} - A Promise Object
* @example
* get('https://example.com').then(resp => { console.log(resp) })
*/*}
const _get = (url,credentials) =>
fetch(url, {
method: 'GET',
credentials,
}).then(resp => Promise.all([resp.ok, resp.status, resp.json(), resp.headers]))
.then(([ok, status, json, headers]) => {
if (ok) {
return json;
} else {
throw new Error(JSON.stringify(json.error));
}
}).catch(error => {
throw error;
});
{*/**
* A Wrapper of Fetch POST Method
* @function _post
* @param {string} url
* @param {string} json - The POST Body in JSON Format
* @returns {function} - A Promise Object
* @example
* _post('https://example.com', JSON.stringify(data)).then(resp => { console.log(resp) })
*/*}
const _post = (url, body) => _request(url, body, 'POST');
let validate,captcha;
let globalConfig;
@ -135,7 +215,13 @@ const tmp = new Vuex.Store({
jumpDelay: '',
isGetestSuccess: '',
registMode: '',
crisp: '',
base_url: '',
isEmailVeryify: '',
login_token: '',
login_number: '',
telegram_bot: '',
enable_telegram: '',
enableLoginCaptcha: '',
enableRegCaptcha: '',
indexMsg: {
@ -162,6 +248,7 @@ const tmp = new Vuex.Store({
},
SET_GLOBALCONFIG (state,config) {
state.logintoken = config.isLogin
state.globalConfig.base_url = config.base_url;
state.globalConfig.captchaProvider = config.captcha_provider;
state.globalConfig.recaptchaSiteKey = config.recaptcha_sitekey;
state.globalConfig.jumpDelay = config.jump_delay;
@ -173,6 +260,8 @@ const tmp = new Vuex.Store({
state.globalConfig.login_token = config.login_token;
state.globalConfig.login_number = config.login_number;
state.globalConfig.telegram_bot = config.telegram_bot;
state.globalConfig.crisp = config.enable_crisp;
state.globalConfig.enable_telegram = config.enable_telegram;
state.globalConfig.indexMsg.appname = config.appName;
state.globalConfig.indexMsg.date = config.dateY;
},
@ -181,7 +270,7 @@ const tmp = new Vuex.Store({
},
SET_JINRISHICI (state,content) {
state.globalConfig.indexMsg.jinrishici = content;
}
},
},
actions: {
CALL_MSGR ({ commit,state },config) {
@ -194,13 +283,17 @@ const tmp = new Vuex.Store({
}
});
var storeAuth = {
var storeMap = {
store: tmp,
computed: Vuex.mapState({
msgrCon: 'msgrCon',
globalConfig: 'globalConfig',
logintoken: 'logintoken',
isLoading: 'isLoading',
}),
}
var storeAuth = {
methods: {
loadCaptcha(id) {
if (this.globalConfig.recaptchaSiteKey !== null ) {
@ -213,14 +306,11 @@ var storeAuth = {
if (this.globalConfig.captchaProvider === 'geetest') {
this.$nextTick(function(){
axios({
method: 'get',
url: '/auth/login_getCaptcha',
responseType: 'json',
}).then((r)=>{
_get('/auth/login_getCaptcha')
.then((r) => {
let GeConfig = {
gt: r.data.GtSdk.gt,
challenge: r.data.GtSdk.challenge,
gt: r.GtSdk.gt,
challenge: r.GtSdk.challenge,
product: "embed",
}
@ -244,14 +334,21 @@ var storeAuth = {
}
},
//加载完成的时间很谜
/* 当然很迷了。
你的 reCAPTCHA 的 container 是在注册页面才渲染的
所以你应该把的 reCAPTCHA 渲染绑定在注册页面渲染事件上。
Sukka. 2019-01-06
*/
grecaptchaRender(id) {
setTimeout(function() {
if (typeof grecaptcha === 'undefined' || typeof grecaptcha.render ==='undefined') {
this.grecaptchaRender();
setTimeout(() => {
if (!grecaptcha || !grecaptcha.render) {
this.grecaptchaRender(id);
} else {
grecaptcha.render(id);
}
},300)
}, 300)
}
},
};
@ -281,7 +378,7 @@ const Auth = {
<div class="auth pure-g align-center">
<div class="pure-u-1 pure-u-sm-4-24 flex wrap space-around auth-links">
<router-link v-for="(links,key) in routerLinks" @click.native="setButtonState" :class="{ active:links.isActive }" class="button-round flex align-center" :to="links.href" :key="links.id">
<span class="icon-round"><i :class="links.icon"></i></span> $[links.content]$
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i :class="links.icon"></i></span><span>$[links.content]$</span>
</router-link>
</div>
<transition name="slide-fade" mode="out-in">
@ -297,21 +394,21 @@ const Auth = {
id: 'R_AUTH_0',
href: '/auth/login',
content: '登录',
icon: ['fa','fa-pencil'],
icon: ['fa','fa-sign-in','fa-stack-1x','fa-inverse'],
isActive: false,
},
register: {
id: 'R_AUTH_1',
href: '/auth/register',
content: '注册',
icon: ['fa','fa-plus'],
icon: ['fa','fa-user-plus','fa-stack-1x','fa-inverse'],
isActive: false,
},
reset: {
id: 'R_PW_0',
href: '/password/reset',
content: '密码重置',
icon: ['fa','fa-gear'],
icon: ['fa','fa-unlock-alt','fa-stack-1x','fa-inverse'],
isActive: false,
},
},
@ -328,6 +425,9 @@ const Auth = {
}
},
},
watch: {
$route: 'setButtonState',
},
beforeRouteEnter (to,from,next) {
next(vm=>{
vm.setButtonState();
@ -341,33 +441,66 @@ const Auth = {
const Login = {
delimiters: ['$[',']$'],
mixins: [storeAuth],
mixins: [storeMap,storeAuth],
computed: Vuex.mapState({
telegramHref: function() {
return 'https://t.me/' + this.globalConfig.telegram_bot;
},
isTgEnabled: function() {
return this.globalConfig.enable_telegram === 'true';
}
}),
template: /*html*/ `
<div class="page-auth pure-g pure-u-1 pure-u-sm-20-24">
<div class="page-auth pure-g pure-u-1 pure-u-sm-20-24 wrap">
<div class="title-back flex align-center">LOGIN</div>
<h1>登录</h1>
<div class="input-control flex wrap">
<label for="Email">邮箱</label>
<input v-model="email" type="text" name="Email">
</div>
<div class="input-control flex wrap">
<label for="Password">密码</label>
<input v-model="passwd" type="password" name="Password">
</div>
<div class="input-control flex wrap">
<uim-checkbox v-model="remember_me">
<span slot="content">记住我</span>
</uim-checkbox>
</div>
<div class="input-control flex wrap">
<div v-if="globalConfig.captchaProvider === 'geetest'" id="embed-captcha-login"></div>
<form action="?" method="POST">
<div v-if="globalConfig.recaptchaSiteKey" id="g-recaptcha-login" class="g-recaptcha" :data-sitekey="globalConfig.recaptchaSiteKey"></div>
</form>
<div class="pure-u-1 basis-max" :class="[ isTgEnabled ? 'pure-u-sm-11-24' : 'pure-u-sm-1-2' ]">
<div class="input-control flex wrap">
<label for="Email">邮箱</label>
<input v-model="email" type="text" name="Email">
</div>
<div class="input-control flex wrap">
<label for="Password">密码</label>
<input v-model="passwd" type="password" name="Password">
</div>
<div class="input-control flex wrap">
<uim-checkbox v-model="remember_me">
<span slot="content">记住我</span>
</uim-checkbox>
</div>
<div class="input-control flex wrap">
<div v-if="globalConfig.captchaProvider === 'geetest'" id="embed-captcha-login"></div>
<form action="?" method="POST">
<div v-if="globalConfig.recaptchaSiteKey" id="g-recaptcha-login" class="g-recaptcha" :data-sitekey="globalConfig.recaptchaSiteKey"></div>
</form>
</div>
<button @click.prevent="login" @keyup.13.native="login" class="auth-submit" id="login" type="submit" :disabled="isDisabled">
确认登录
</button>
</div>
<button @click.prevent="login" @keyup.13.native="login" class="auth-submit" id="login" type="submit" :disabled="isDisabled">
确认登录
</button>
<div v-if="globalConfig.enable_telegram === 'true'" class="pure-u-1 pure-u-sm-11-24 pure-g auth-tg">
<h3>Telegram登录</h3>
<div>
<p>Telegram OAuth一键登陆</p>
</div>
<p id="telegram-alert">正在载入 Telegram,如果长时间未显示请刷新页面或检查代理</p>
<div class="text-center" id="telegram-login-box"></div>
<p>或者添加机器人账号 <a :href="telegramHref">@$[globalConfig.telegram_bot]$</a>,发送下面的数字/二维码验证码给它
</p>
<transition name="fade" mode="out-in">
<div v-if="!isTgtimeout" class="pure-g pure-u-20-24" key="notTimeout">
<div class="text-center qr-center pure-u-11-24">
<div id="telegram-qr" class="flex space-around"></div>
</div>
<div class="pure-u-11-24">
<div class="auth-submit" id="code_number">$[globalConfig.login_number]$</div>
</div>
</div>
<div v-else class="pure-g space-around" key="timeout">
<div class="auth-submit pure-u-18-24 tg-timeout">验证方式已过期,请刷新页面后重试</div>
</div>
</transition>
</div>
</div>
`,
data: function () {
@ -376,6 +509,7 @@ const Login = {
passwd: '',
remember_me: false,
isDisabled: false,
isTgtimeout: false,
}
},
methods: {
@ -411,16 +545,12 @@ const Login = {
}
}
axios({
method: 'post',
url: '/auth/login',
data: ajaxCon,
}).then((r)=>{
if (r.data.ret == 1) {
_post('/auth/login', JSON.stringify(ajaxCon)).then((r) => {
if (r.ret === 1) {
callConfig.msg += '登录成功Kira~';
callConfig.icon += 'fa-check-square-o';
tmp.dispatch('CALL_MSGR',callConfig);
window.setTimeout(()=>{
window.setTimeout(() => {
tmp.commit('SET_LOGINTOKEN',1);
this.$router.replace('/user/panel');
}, this.globalConfig.jumpDelay);
@ -430,11 +560,65 @@ const Login = {
tmp.dispatch('CALL_MSGR',callConfig);
window.setTimeout(()=>{
this.isDisabled = false;
},3000)
}, 3000)
}
});
},
telegramRender() {
let el = document.createElement('script');
document.getElementById('telegram-login-box').append(el);
el.onload = function () {
document.getElementById('telegram-alert').outerHTML = '';
}
el.src = 'https://telegram.org/js/telegram-widget.js?4';
el.setAttribute('data-size', 'large');
el.setAttribute('data-telegram-login', this.globalConfig.telegram_bot);
el.setAttribute('data-auth-url', this.globalConfig.base_url + '/auth/telegram_oauth');
el.setAttribute('data-request-access', 'write');
let telegram_qrcode = 'mod://login/' + this.globalConfig.login_token;
let qrcode = new QRCode(document.getElementById("telegram-qr"));
qrcode.clear();
qrcode.makeCode(telegram_qrcode);
},
tgAuthTrigger(tid) {
if (this.logintoken == true) {
return;
}
let callConfig = {
msg: '',
icon: '',
};
_post('/auth/qrcode_check', JSON.stringify({
token: this.globalConfig.login_token,
number: this.globalConfig.login_number,
})).then((r) => {
if(r.ret > 0) {
clearTimeout(tid);
_post('/auth/qrcode_login',JSON.stringify({
token: this.globalConfig.login_token,
number: this.globalConfig.login_number,
})).then(r=>{
if (r.ret) {
callConfig.msg += '登录成功Kira~';
callConfig.icon += 'fa-check-square-o';
tmp.dispatch('CALL_MSGR',callConfig);
window.setTimeout(()=>{
tmp.commit('SET_LOGINTOKEN',1);
this.$router.replace('/user/panel');
}, this.globalConfig.jumpDelay);
}
})
} else if (r.ret == -1) {
this.isTgtimeout = true;
}
});
tid = setTimeout(()=>{
this.tgAuthTrigger(tid);
}, 2500);
}
},
mounted() {
document.addEventListener('keyup',(e)=>{
@ -443,6 +627,13 @@ const Login = {
}
});
if (this.globalConfig.enable_telegram === 'true') {
this.telegramRender();
let tid = setTimeout(() => {
this.tgAuthTrigger(tid);
}, 2500);
}
if (this.globalConfig.enableLoginCaptcha === 'false') {
return;
}
@ -453,9 +644,9 @@ const Login = {
const Register = {
delimiters: ['$[',']$'],
mixins: [storeAuth],
mixins: [storeMap,storeAuth],
template: /*html*/ `
<div class="page-auth pure-g pure-u-20-24">
<div class="page-auth pure-g pure-u-1 pure-u-sm-20-24">
<div class="title-back flex align-center">REGISTER</div>
<h1>账号注册</h1>
<div class="flex space-around reg">
@ -548,9 +739,13 @@ const Register = {
icon: '',
};
if (this.globalConfig.isEmailVeryify === 'true') {
ajaxCon.emailcode = this.email_code;
}
if (this.globalConfig.registMode !== 'invite') {
ajaxCon.code = 0;
if ((this.getCookie('code'))!='') {
if ((this.getCookie('code')) !== '') {
ajaxCon.code = this.getCookie('code');
}
}
@ -570,15 +765,10 @@ const Register = {
}
break;
}
}
axios({
method: 'post',
url: '/auth/register',
responseType: 'json',
data: ajaxCon,
}).then((r)=>{
if (r.data.ret == 1) {
}
_post('/auth/register', JSON.stringify(ajaxCon)).then((r)=>{
if (r.ret == 1) {
callConfig.msg += '注册成功meow~';
callConfig.icon += 'fa-check-square-o';
tmp.dispatch('CALL_MSGR',callConfig);
@ -651,13 +841,8 @@ const Register = {
email: this.email,
}
axios({
method: 'post',
url: 'auth/send',
responseType: 'json',
data: ajaxCon,
}).then((r)=>{
if (r.data.ret) {
_post('auth/send', JSON.stringify(ajaxCon)).then((r)=>{
if (r.ret) {
let callConfig = {
msg: 'biu~邮件发送成功',
icon: 'fa-check-square-o',
@ -686,7 +871,7 @@ const Register = {
}
}
document.addEventListener('keyup',(e)=>{
document.addEventListener('keyup', (e) => {
if (e.keyCode == 13) {
this.register();
}
@ -708,15 +893,64 @@ const Password = {
<router-view></router-view>
</div>
`,
props: ['routermsg'],
}
const Reset = {
delimiters: ['$[',']$'],
mixins: [storeMap],
template: /*html*/ `
<div class="page-pw pure-u-1">
<h1>密码重置页demo</h1>
<div class="page-pw pure-u-1 pure-g flex align-center space-around wrap">
<div class="title-back flex align-center">PASSWORD</div>
<div class="pure-u-1 pure-u-sm-10-24 flex space-around wrap basis-max">
<h1>密码重置</h1>
<div class="input-control flex wrap">
<label for="Email" class="flex space-between align-center">
<span>邮箱</span>
<span><router-link class="button-index" to="/auth/login"><i class="fa fa-mail-forward"></i> 返回登录页</router-link></span>
</label>
<input v-model="email" type="text" name="Email">
</div>
<button @click.prevent="reset" @keyup.13.native="reset" class="auth-submit" id="reset" type="submit" :disabled="isDisabled">
重置密码
</button>
</div>
</div>
`,
data: function() {
return {
email: '',
isDisabled: false,
}
},
methods: {
reset() {
let callConfig = {
msg: '',
icon: '',
};
_post('/password/reset', JSON.stringify({
email: this.email,
})).then(r => {
if (r.ret == 1) {
callConfig.msg += '邮件发送成功kira~';
callConfig.icon += 'fa-check-square-o';
tmp.dispatch('CALL_MSGR',callConfig);
window.setTimeout(() => {
this.$router.push('/auth/login');
}, this.globalConfig.jumpDelay);
} else {
callConfig.msg += 'WTF……邮件发送失败,请检查邮箱地址';
callConfig.icon += 'fa-times-circle-o';
tmp.dispatch('CALL_MSGR',callConfig);
window.setTimeout(()=>{
this.isDisabled = false;
}, 3000)
}
})
}
},
}
const User = {
@ -733,18 +967,45 @@ const Panel = {
delimiters: ['$[',']$'],
template: /*html*/ `
<div class="page-user pure-u-1">
<h1>用户页面demo</h1>
<a href="/user" class="button-index">进入用户中心</a>
<div class="title-back flex align-center">USERCENTER</div>
<transition name="loading-fadex" mode="out-in">
<div class="loading flex align-center" v-if="userLoadState === 'beforeload'">USERCENTER</div>
<div class="loading flex align-center" v-else-if="userLoadState === 'loading'" key="loading">
<div class="spinnercube">
<div class="cube1"></div>
<div class="cube2"></div>
</div>
</div>
<div class="usrcenter text-left" v-else-if="userLoadState === 'loaded'">
<h1>用户中心</h1>
<a href="/user" class="button-index">进入管理面板</a>
</div>
</transition>
</div>
`,
props: ['routermsg'],
data: function() {
return {
userLoadState: 'beforeload',
userCon: '',
}
},
mounted() {
axios.get('/user/getuserinfo')
.then((r)=>{
if (r.data.ret === 1) {
console.log(r.data.info);
}
});
let self = this;
this.userLoadState = 'loading';
_get('/user/getuserinfo').then((r) => {
if (r.ret === 1) {
console.log(r.info);
this.userCon = r.info.user;
console.log(this.userCon);
}
}).then(r=>{
setTimeout(()=>{
self.userLoadState = 'loaded';
},1000)
});
},
beforeRouteLeave (to, from, next) {
if (to.matched.some(function(record) {
@ -762,6 +1023,9 @@ const vueRoutes = [
path: '/',
components: {
default: Root,
},
meta: {
title: 'Index',
}
},
{
@ -769,16 +1033,22 @@ const vueRoutes = [
component: Auth,
redirect: '/auth/login',
meta: {
alreadyAuth: true
alreadyAuth: true,
},
children: [
{
path: 'login',
path: 'Login',
component: Login,
meta: {
title: 'login',
}
},
{
path: 'register',
component: Register,
meta: {
title: 'Register',
}
},
],
},
@ -793,6 +1063,9 @@ const vueRoutes = [
{
path: 'reset',
component: Reset,
meta: {
title: 'Reset',
}
},
],
},
@ -807,6 +1080,9 @@ const vueRoutes = [
{
path: 'panel',
component: Panel,
meta: {
title: 'Usercenter',
}
}
]
}
@ -818,10 +1094,9 @@ const Router = new VueRouter({
Router.beforeEach((to,from,next)=>{
if (!globalConfig) {
axios.get('/globalconfig')
.then((r)=>{
if (r.data.ret == 1) {
globalConfig = r.data.globalConfig;
_get('/globalconfig').then((r)=>{
if (r.ret == 1) {
globalConfig = r.globalConfig;
if (globalConfig.geetest_html && globalConfig.geetest_html.success) {
globalConfig.isGetestSuccess = '1';
tmp.commit('SET_GLOBALCONFIG',globalConfig);
@ -847,6 +1122,7 @@ Router.beforeEach((to,from,next)=>{
})) {
next('/auth/login');
} else {
document.title = tmp.state.globalConfig.indexMsg.appname + ' - ' + to.meta.title;
next();
}
}
@ -898,17 +1174,11 @@ const indexPage = new Vue({
router: Router,
el: '#index',
delimiters: ['$[',']$'],
store: tmp,
mixins: [storeMap],
data: {
routerN: 'auth',
transType: 'slide-fade'
},
computed: Vuex.mapState({
msgrCon: 'msgrCon',
globalConfig: 'globalConfig',
logintoken: 'logintoken',
isLoading: 'isLoading',
}),
methods: {
routeJudge() {
switch(this.$route.path) {
@ -935,21 +1205,24 @@ const indexPage = new Vue({
}
},
beforeMount() {
axios.get('https://api.lwl12.com/hitokoto/v1')
.then((r)=>{
tmp.commit('SET_HITOKOTO',r.data);
_get('https://api.lwl12.com/hitokoto/v1?encode=realjson').then((r) => {
let hitokoto
if (r.author === '' && r.source === '') {
hitokoto = r.text;
} else {
hitokoto = r.text + ' —— ' + r.author + r.source;
}
tmp.commit('SET_HITOKOTO',hitokoto);
})
axios.get('https://v2.jinrishici.com/one.json',{
withCredentials: true,
}).then((r)=>{
tmp.commit('SET_JINRISHICI',r.data.data.content);
_get('https://v2.jinrishici.com/one.json','include').then((r) => {
tmp.commit('SET_JINRISHICI',r.data.content);
})
},
mounted() {
this.routeJudge();
setTimeout(()=>{
tmp.commit('SET_LOADSTATE');
},1000)
},1000);
},
});

@ -89,7 +89,7 @@
if(data.ret == 1){
$("#result").modal();
$("#msg").html(data.msg);
// window.setTimeout("location.href='/auth/login'", 2000);
window.setTimeout("location.href='/auth/login'", 2000);
}else{
$("#result").modal();
$("#msg").html(data.msg);

@ -130,9 +130,11 @@
{if $user->im_type==4}
Telegram
{/if}
{$user->im_value}
</code>
</p>
<p>当前联络方式账号:
<code>{$user->im_value}</code>
</p>
<div class="form-group form-group-label control-highlight-custom dropdown">
<label class="floating-label" for="imtype">选择您的联络方式</label>
<button class="form-control maxwidth-edit" id="imtype" data-toggle="dropdown" value="{$user->im_type}">

Loading…
Cancel
Save