diff --git a/application/admin/command/Install.php b/application/admin/command/Install.php
index 265d2b1a..3be7f949 100644
--- a/application/admin/command/Install.php
+++ b/application/admin/command/Install.php
@@ -74,6 +74,9 @@ class Install extends Command
file_put_contents($installLockFile, 1);
+ //后台入口文件
+ $adminFile = ROOT_PATH . 'public' . DS . 'admin.php';
+
$dbConfigFile = APP_PATH . 'database.php';
$config = @file_get_contents($dbConfigFile);
$callback = function ($matches) use ($hostname, $hostport, $username, $password, $database, $prefix) {
@@ -88,6 +91,16 @@ class Install extends Command
// 写入数据库配置
file_put_contents($dbConfigFile, $config);
+ // 修改后台入口
+ if (is_file($adminFile)) {
+ $x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $adminName = substr(str_shuffle(str_repeat($x, ceil(10 / strlen($x)))), 1, 10) . '.php';
+ rename($adminFile, ROOT_PATH . 'public' . DS . $adminName);
+ $output->highlight("Admin url:http://www.yoursite.com/{$adminName}");
+ }
+ $output->highlight("Admin username:admin");
+ $output->highlight("Admin password:123456");
+
\think\Cache::rm('__menu__');
$output->info("Install Successed!");
diff --git a/application/admin/controller/general/Profile.php b/application/admin/controller/general/Profile.php
index a493948b..3cf3ff06 100644
--- a/application/admin/controller/general/Profile.php
+++ b/application/admin/controller/general/Profile.php
@@ -6,6 +6,7 @@ use app\admin\model\Admin;
use app\common\controller\Backend;
use fast\Random;
use think\Session;
+use think\Validate;
/**
* 个人配置
@@ -59,10 +60,20 @@ class Profile extends Backend
array_flip(array('email', 'nickname', 'password', 'avatar'))
));
unset($v);
+ if (!Validate::is($params['email'], "email")) {
+ $this->error(__("Please input correct email"));
+ }
if (isset($params['password'])) {
+ if (!Validate::is($params['password'], "/^[\S]{6,16}$/")) {
+ $this->error(__("Please input correct password"));
+ }
$params['salt'] = Random::alnum();
$params['password'] = md5(md5($params['password']) . $params['salt']);
}
+ $exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find();
+ if ($exist) {
+ $this->error(__("Email already exists"));
+ }
if ($params) {
$admin = Admin::get($this->auth->id);
$admin->save($params);
diff --git a/application/admin/lang/zh-cn/general/config.php b/application/admin/lang/zh-cn/general/config.php
index 317ee88f..21e8371c 100644
--- a/application/admin/lang/zh-cn/general/config.php
+++ b/application/admin/lang/zh-cn/general/config.php
@@ -53,6 +53,7 @@ return [
'Mail vertify type' => 'SMTP验证方式',
'Mail from' => '发件人邮箱',
'Name already exist' => '变量名称已经存在',
+ 'Add new config' => '点击添加新的配置',
'Send a test message' => '发送测试邮件',
'This is a test mail content' => '这是一封来自FastAdmin校验邮件,用于校验邮件配置是否正常!',
'This is a test mail' => '这是一封来自FastAdmin的邮件',
diff --git a/application/admin/lang/zh-cn/general/profile.php b/application/admin/lang/zh-cn/general/profile.php
index 1c707bd3..8f5ff030 100644
--- a/application/admin/lang/zh-cn/general/profile.php
+++ b/application/admin/lang/zh-cn/general/profile.php
@@ -7,4 +7,7 @@ return [
'Click to edit' => '点击编辑',
'Admin log' => '操作日志',
'Leave password blank if dont want to change' => '不修改密码请留空',
+ 'Please input correct email' => '请输入正确的Email地址',
+ 'Please input correct password' => '密码长度不正确',
+ 'Email already exists' => '邮箱已经存在',
];
diff --git a/application/admin/library/Auth.php b/application/admin/library/Auth.php
index d9a655e3..b9858c8d 100644
--- a/application/admin/library/Auth.php
+++ b/application/admin/library/Auth.php
@@ -7,6 +7,7 @@ use fast\Random;
use fast\Tree;
use think\Config;
use think\Cookie;
+use think\Hook;
use think\Request;
use think\Session;
@@ -361,6 +362,8 @@ class Auth extends \fast\Auth
*/
public function getSidebar($params = [], $fixedPage = 'dashboard')
{
+ // 边栏开始
+ Hook::listen("admin_sidebar_begin", $params);
$colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
$colorNums = count($colorArr);
$badgeList = [];
diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html
index 82c431ca..6d24fb1b 100644
--- a/application/admin/view/general/config/index.html
+++ b/application/admin/view/general/config/index.html
@@ -23,7 +23,7 @@
{:__($vo.title)}
{/foreach}
-
+
diff --git a/application/api/controller/Sms.php b/application/api/controller/Sms.php
index fc3a1318..b1c1410b 100644
--- a/application/api/controller/Sms.php
+++ b/application/api/controller/Sms.php
@@ -5,6 +5,7 @@ namespace app\api\controller;
use app\common\controller\Api;
use app\common\library\Sms as Smslib;
use app\common\model\User;
+use think\Hook;
/**
* 手机短信接口
@@ -50,11 +51,14 @@ class Sms extends Api
$this->error(__('未注册'));
}
}
+ if (!Hook::get('sms_send')) {
+ $this->error(__('请在后台插件管理安装短信验证插件'));
+ }
$ret = Smslib::send($mobile, null, $event);
if ($ret) {
$this->success(__('发送成功'));
} else {
- $this->error(__('发送失败'));
+ $this->error(__('发送失败,请检查短信配置是否正确'));
}
}
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 56198141..4cc5a2ab 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -96,6 +96,7 @@ class User extends Api
* @param string $password 密码
* @param string $email 邮箱
* @param string $mobile 手机号
+ * @param string $code 验证码
*/
public function register()
{
@@ -103,6 +104,7 @@ class User extends Api
$password = $this->request->request('password');
$email = $this->request->request('email');
$mobile = $this->request->request('mobile');
+ $code = $this->request->request('code');
if (!$username || !$password) {
$this->error(__('Invalid parameters'));
}
@@ -112,6 +114,10 @@ class User extends Api
if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
$this->error(__('Mobile is incorrect'));
}
+ $ret = Sms::check($mobile, $code, 'register');
+ if (!$ret) {
+ $this->error(__('Captcha is incorrect'));
+ }
$ret = $this->auth->register($username, $password, $email, $mobile, []);
if ($ret) {
$data = ['userinfo' => $this->auth->getUserinfo()];
diff --git a/application/config.php b/application/config.php
index 43adb50b..cdd94936 100755
--- a/application/config.php
+++ b/application/config.php
@@ -57,7 +57,7 @@ return [
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
- 'deny_module_list' => ['common'],
+ 'deny_module_list' => ['common', 'admin'],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
@@ -272,7 +272,7 @@ return [
//自动检测更新
'checkupdate' => false,
//版本号
- 'version' => '1.0.0.20190705_beta',
+ 'version' => '1.0.0.20190930_beta',
//API接口地址
'api_url' => 'https://api.fastadmin.net',
],
diff --git a/application/index/controller/User.php b/application/index/controller/User.php
index 0c346918..b436a863 100644
--- a/application/index/controller/User.php
+++ b/application/index/controller/User.php
@@ -3,6 +3,7 @@
namespace app\index\controller;
use app\common\controller\Frontend;
+use app\common\library\Sms;
use think\Config;
use think\Cookie;
use think\Hook;
@@ -85,13 +86,13 @@ class User extends Frontend
$email = $this->request->post('email');
$mobile = $this->request->post('mobile', '');
$captcha = $this->request->post('captcha');
+ $code = $this->request->post('code');
$token = $this->request->post('__token__');
$rule = [
'username' => 'require|length:3,30',
'password' => 'require|length:6,30',
'email' => 'require|email',
'mobile' => 'regex:/^1\d{10}$/',
- 'captcha' => 'require|captcha',
'__token__' => 'require|token',
];
@@ -100,8 +101,8 @@ class User extends Frontend
'username.length' => 'Username must be 3 to 30 characters',
'password.require' => 'Password can not be empty',
'password.length' => 'Password must be 6 to 30 characters',
- 'captcha.require' => 'Captcha can not be empty',
- 'captcha.captcha' => 'Captcha is incorrect',
+ //'captcha.require' => 'Captcha can not be empty',
+ //'captcha.captcha' => 'Captcha is incorrect',
'email' => 'Email is incorrect',
'mobile' => 'Mobile is incorrect',
];
@@ -110,9 +111,13 @@ class User extends Frontend
'password' => $password,
'email' => $email,
'mobile' => $mobile,
- 'captcha' => $captcha,
+ //'captcha' => $captcha,
'__token__' => $token,
];
+ $ret = Sms::check($mobile, $code, 'register');
+ if (!$ret) {
+ $this->error(__('Captcha is incorrect'));
+ }
$validate = new Validate($rule, $msg);
$result = $validate->check($data);
if (!$result) {
diff --git a/application/index/lang/zh-cn/index.php b/application/index/lang/zh-cn/index.php
index 7cf60265..2f528975 100755
--- a/application/index/lang/zh-cn/index.php
+++ b/application/index/lang/zh-cn/index.php
@@ -2,12 +2,13 @@
return [
'Title' => '标题',
+ 'CRUD' => '一键CRUD',
'Auth tips' => '基于完善的Auth权限控制管理、无限父子级权限分组、可自由分配子级权限、一个管理员可同时属于多个组别',
'Responsive tips' => '基于Bootstrap和AdminLTE进行二次开发,手机、平板、PC均自动适配,无需要担心兼容性问题',
'Languages tips' => '不仅仅后台开发支持多语言,同时视图部分和JS部分仍然共享同一个语言包,语法相同且自动加载',
'Module tips' => '控制器、模型、视图、JS一一对应,使用RequireJS进行JS模块化管理,采用Bower进行前端包组件管理',
- 'CRUD tips' => '控制台进行一键生成控制器、模型、视图和JS文件,一键生成API文档,一键生成后台权限节点和菜单栏',
- 'Extension tips' => 'FastAdmin提供强大的扩展中心,可直接在线安装和卸载插件,同时支持命令行一键操作',
+ 'CRUD tips' => '可使用命令行一键生成控制器、模型、视图和JS文件,一键生成API文档,一键生成回收站,一键生成后台权限节点和菜单栏',
+ 'Extension tips' => 'FastAdmin提供强大丰富的应用(插件)市场,可直接在线安装和卸载用户(插件),同时支持命令行一键操作',
'Do not hesitate' => '不要犹豫',
'Start to act' => '开始行动',
];
diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html
index 87d0415c..3d52cb30 100755
--- a/application/index/view/index/index.html
+++ b/application/index/view/index/index.html
@@ -63,7 +63,6 @@
@@ -147,7 +146,7 @@