Browse Source

add sms code send for login page

master
filesite 7 months ago
parent
commit
f211650c2e
  1. 2
      plugins/Common.php
  2. 15
      themes/tajian/controller/SiteController.php
  3. 2
      themes/tajian/views/site/login.php
  4. 2
      www/js/tajian.js

2
plugins/Common.php

@ -36,7 +36,7 @@ Class Common { @@ -36,7 +36,7 @@ Class Common {
$userDir = "{$rootDir}{$cellphone}";
mkdir("{$userDir}/data/", 0755, true); //分享视频目录
if (!is_dir("{$userDir}/data/")) {
throw new Exception("创建用户数据目录失败:{$userDir}/data/");
throw new Exception("创建用户数据目录失败,请检查目录 www/" . FSC::$app['config']['content_directory'] . " 权限配置,允许PHP写入");
}
mkdir("{$userDir}/tags/", 0700, true); //分类目录

15
themes/tajian/controller/SiteController.php

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
*/
require_once __DIR__ . '/../../../lib/DirScanner.php';
require_once __DIR__ . '/../../../plugins/Parsedown.php';
require_once __DIR__ . '/../../../plugins/Common.php';
Class SiteController extends Controller {
@ -218,6 +219,13 @@ Class SiteController extends Controller { @@ -218,6 +219,13 @@ Class SiteController extends Controller {
//邀请制新用户注册,使用手机号码 + 邀请码 + 短信验证码注册
public function actionRegister() {
//判断是否已经登录
$loginedUser = Common::getUserFromSession();
if (!empty($loginedUser['username'])) {
$shareUrl = "/{$loginedUser['username']}/";
return $this->redirect($shareUrl);
}
$pageTitle = "注册Ta荐:一个好用的视频收藏夹,帮你整理不同平台的好视频,还能分享给朋友!";
$this->layout = 'index';
@ -230,6 +238,13 @@ Class SiteController extends Controller { @@ -230,6 +238,13 @@ Class SiteController extends Controller {
//用户登陆:使用手机号码 + 短信验证码登录
public function actionLogin() {
//判断是否已经登录
$loginedUser = Common::getUserFromSession();
if (!empty($loginedUser['username'])) {
$shareUrl = "/{$loginedUser['username']}/";
return $this->redirect($shareUrl);
}
$pageTitle = "登录Ta荐:一个好用的视频收藏夹,帮你整理不同平台的好视频,还能分享给朋友!";
$this->layout = 'index';

2
themes/tajian/views/site/login.php

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<div class="mb-3 twocol">
<label for="text_input_sm" class="form-label">验证码</label>
<input id="text_input_sm" name="smscode" placeholder="输入收到的短信验证码">
<button disabled="disabled">发送验证码</button>
<button disabled="disabled" class="bt_sms_JS">发送验证码</button>
</div>
<div class="avform_bt vercenter">
<button class="jsbtn" aria-label="注册" type="button">

2
www/js/tajian.js

@ -305,6 +305,8 @@ if ($('#register_form').get(0)) { @@ -305,6 +305,8 @@ if ($('#register_form').get(0)) {
// 登录
if ($('#login_form').get(0)) {
$('#login_form input[name=username]').blur(smsCodeBtnHandler);
$('#login_form .jsbtn').click(function(e) {
e.preventDefault();

Loading…
Cancel
Save