Commit 7242a91d by 杨树贤

修改校验规则

parent 68c9cba1
...@@ -24,7 +24,7 @@ REDIS_PASSWORD=icDb29mLy2s ...@@ -24,7 +24,7 @@ REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379 REDIS_PORT=6379
MAIL_MAILER=smtp MAIL_MAILER=smtp
MAIL_FROM_ADDRESS="lx@ichunt.com" MAIL_FROM_ADDRESS="system@semour.com"
MAIL_FROM_NAME="semour.com" MAIL_FROM_NAME="semour.com"
MAIL_DRIVER=smtp MAIL_DRIVER=smtp
MAIL_HOST='smtp.semour.com' MAIL_HOST='smtp.semour.com'
......
...@@ -46,7 +46,7 @@ class AuthApiController extends Controller ...@@ -46,7 +46,7 @@ class AuthApiController extends Controller
{ {
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'email' => 'required|string|email|max:255', 'email' => 'required|string|email|max:255',
'password' => 'required|string|min:8', 'password' => 'required|string|min:8|max:50',
], [ ], [
'password.min' => 'Password must be at least 8 characters long.' 'password.min' => 'Password must be at least 8 characters long.'
]); ]);
...@@ -87,8 +87,8 @@ class AuthApiController extends Controller ...@@ -87,8 +87,8 @@ class AuthApiController extends Controller
{ {
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'old_password' => 'required|min:8', 'old_password' => 'required|min:8|max:50',
'password' => ['required', 'string', 'min:8', 'confirmed'], 'password' => ['required', 'string', 'min:8', 'max:50', 'confirmed'],
], [ ], [
'old_password.min' => 'Password must be at least 8 characters long.', 'old_password.min' => 'Password must be at least 8 characters long.',
'password.min' => 'Password must be at least 8 characters long.', 'password.min' => 'Password must be at least 8 characters long.',
...@@ -144,7 +144,7 @@ class AuthApiController extends Controller ...@@ -144,7 +144,7 @@ class AuthApiController extends Controller
public function setForgetPassword(Request $request) public function setForgetPassword(Request $request)
{ {
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'password' => ['required', 'string', 'min:8', 'confirmed'], 'password' => ['required', 'string', 'min:8', 'max:50', 'confirmed'],
'email_code' => 'required', 'email_code' => 'required',
'email' => 'required|email' 'email' => 'required|email'
], []); ], []);
...@@ -214,7 +214,7 @@ class AuthApiController extends Controller ...@@ -214,7 +214,7 @@ class AuthApiController extends Controller
Redis::expire($redisKey, 120); Redis::expire($redisKey, 120);
$subject = config('mail.from.name'); $subject = config('mail.from.name');
return $this->setSuccessData($code); // return $this->setSuccessData($code);
Mail::to($email)->send(new SendCode($type, $code)); Mail::to($email)->send(new SendCode($type, $code));
//错误处理 //错误处理
if (count(Mail::failures())) { if (count(Mail::failures())) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Http\Requests; namespace App\Http\Requests;
use App\Models\UserModel;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
class UserRegister extends BaseRequest class UserRegister extends BaseRequest
...@@ -23,18 +24,19 @@ class UserRegister extends BaseRequest ...@@ -23,18 +24,19 @@ class UserRegister extends BaseRequest
*/ */
public function rules() public function rules()
{ {
return [ $rule = [
[ 'email' => 'required|string|email|max:100',
'email' => 'required|string|email|max:100', 'password' => 'required|min:8|max:50|string|confirmed',
'password' => 'required|string|min:8|confirmed', 'first_name' => 'required|max:50',
'first_name' => 'required|max:50', 'last_name' => 'required|max:50',
'last_name' => 'required|max:50', 'email_code' => 'required|max:10',
'email_code' => 'required|max:10', 'phone' => 'required|max:100',
'phone' => 'required|max:100', 'account_properties' => 'required|in:1,2'
'company_name' => 'required|max:50',
'account_properties' => 'required|in:1,2'
]
]; ];
if (request()->input('account_properties') == 2) {
$rule['company_name'] = 'required|max:50';
}
return $rule;
} }
public function messages() public function messages()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment