Commit 7242a91d by 杨树贤

修改校验规则

parent 68c9cba1
......@@ -24,7 +24,7 @@ REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_FROM_ADDRESS="lx@ichunt.com"
MAIL_FROM_ADDRESS="system@semour.com"
MAIL_FROM_NAME="semour.com"
MAIL_DRIVER=smtp
MAIL_HOST='smtp.semour.com'
......
......@@ -46,7 +46,7 @@ class AuthApiController extends Controller
{
$validator = Validator::make($request->all(), [
'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.'
]);
......@@ -87,8 +87,8 @@ class AuthApiController extends Controller
{
$validator = Validator::make($request->all(), [
'old_password' => 'required|min:8',
'password' => ['required', 'string', 'min:8', 'confirmed'],
'old_password' => 'required|min:8|max:50',
'password' => ['required', 'string', 'min:8', 'max:50', 'confirmed'],
], [
'old_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
public function setForgetPassword(Request $request)
{
$validator = Validator::make($request->all(), [
'password' => ['required', 'string', 'min:8', 'confirmed'],
'password' => ['required', 'string', 'min:8', 'max:50', 'confirmed'],
'email_code' => 'required',
'email' => 'required|email'
], []);
......@@ -214,7 +214,7 @@ class AuthApiController extends Controller
Redis::expire($redisKey, 120);
$subject = config('mail.from.name');
return $this->setSuccessData($code);
// return $this->setSuccessData($code);
Mail::to($email)->send(new SendCode($type, $code));
//错误处理
if (count(Mail::failures())) {
......
......@@ -2,6 +2,7 @@
namespace App\Http\Requests;
use App\Models\UserModel;
use Illuminate\Foundation\Http\FormRequest;
class UserRegister extends BaseRequest
......@@ -23,18 +24,19 @@ class UserRegister extends BaseRequest
*/
public function rules()
{
return [
[
'email' => 'required|string|email|max:100',
'password' => 'required|string|min:8|confirmed',
'first_name' => 'required|max:50',
'last_name' => 'required|max:50',
'email_code' => 'required|max:10',
'phone' => 'required|max:100',
'company_name' => 'required|max:50',
'account_properties' => 'required|in:1,2'
]
$rule = [
'email' => 'required|string|email|max:100',
'password' => 'required|min:8|max:50|string|confirmed',
'first_name' => 'required|max:50',
'last_name' => 'required|max:50',
'email_code' => 'required|max:10',
'phone' => 'required|max:100',
'account_properties' => 'required|in:1,2'
];
if (request()->input('account_properties') == 2) {
$rule['company_name'] = 'required|max:50';
}
return $rule;
}
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