Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7242a91d
authored
Nov 24, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改校验规则
parent
68c9cba1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
.env
app/Http/Controllers/Api/AuthApiController.php
app/Http/Requests/UserRegister.php
.env
View file @
7242a91d
...
...
@@ -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'
...
...
app/Http/Controllers/Api/AuthApiController.php
View file @
7242a91d
...
...
@@ -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
()))
{
...
...
app/Http/Requests/UserRegister.php
View file @
7242a91d
...
...
@@ -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
[
[
$rule
=
[
'email'
=>
'required|string|email|max:100'
,
'password'
=>
'required|string|min:8
|confirmed'
,
'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'
,
'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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment