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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
17 deletions
.env
app/Http/Controllers/Api/AuthApiController.php
app/Http/Requests/UserRegister.php
.env
View file @
7242a91d
...
@@ -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'
...
...
app/Http/Controllers/Api/AuthApiController.php
View file @
7242a91d
...
@@ -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
()))
{
...
...
app/Http/Requests/UserRegister.php
View file @
7242a91d
...
@@ -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
()
...
...
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