From f211650c2efc36e029f5850cc2d411b211329630 Mon Sep 17 00:00:00 2001 From: filesite Date: Sun, 5 May 2024 12:41:14 +0000 Subject: [PATCH] add sms code send for login page --- plugins/Common.php | 2 +- themes/tajian/controller/SiteController.php | 15 +++++++++++++++ themes/tajian/views/site/login.php | 2 +- www/js/tajian.js | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/Common.php b/plugins/Common.php index cdfdec1..6ee15e9 100644 --- a/plugins/Common.php +++ b/plugins/Common.php @@ -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); //分类目录 diff --git a/themes/tajian/controller/SiteController.php b/themes/tajian/controller/SiteController.php index 7228722..20e1af2 100644 --- a/themes/tajian/controller/SiteController.php +++ b/themes/tajian/controller/SiteController.php @@ -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 { //邀请制新用户注册,使用手机号码 + 邀请码 + 短信验证码注册 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 { //用户登陆:使用手机号码 + 短信验证码登录 public function actionLogin() { + //判断是否已经登录 + $loginedUser = Common::getUserFromSession(); + if (!empty($loginedUser['username'])) { + $shareUrl = "/{$loginedUser['username']}/"; + return $this->redirect($shareUrl); + } + $pageTitle = "登录Ta荐:一个好用的视频收藏夹,帮你整理不同平台的好视频,还能分享给朋友!"; $this->layout = 'index'; diff --git a/themes/tajian/views/site/login.php b/themes/tajian/views/site/login.php index 4d4dd2a..33a71f3 100644 --- a/themes/tajian/views/site/login.php +++ b/themes/tajian/views/site/login.php @@ -7,7 +7,7 @@
- +