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
4101e78a
authored
Dec 05, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev/ver/1.0.0'
parents
d732050e
9479ff2d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
28 deletions
app/Http/Controllers/Api/AuthApiController.php
app/Mail/SendCode.php
resources/views/emails/code.blade.php
app/Http/Controllers/Api/AuthApiController.php
View file @
4101e78a
...
@@ -192,18 +192,27 @@ class AuthApiController extends Controller
...
@@ -192,18 +192,27 @@ class AuthApiController extends Controller
return
$this
->
setError
(
$validator
->
errors
()
->
first
());
return
$this
->
setError
(
$validator
->
errors
()
->
first
());
}
}
$info
=
UserModel
::
where
(
'email'
,
$email
)
->
first
();
$info
=
UserModel
::
where
(
'email'
,
$email
)
->
first
();
$msg
=
''
;
switch
(
$type
)
{
switch
(
$type
)
{
case
'register'
:
case
'register'
:
if
(
$info
)
{
if
(
$info
)
{
return
$this
->
setError
(
'This email had been registered'
);
//
return $this->setError('This email had been registered');
}
}
$msg
=
'You are registering an account with us.'
;
break
;
break
;
case
'forget_password'
:
case
'forget_password'
:
$msg
=
'You are trying to reset your password.'
;
$existEmail
=
UserModel
::
where
(
'email'
,
$email
)
->
exists
();
if
(
!
$existEmail
)
{
return
$this
->
setError
(
'This email is not registered'
);
}
break
;
case
'update_email'
:
case
'update_email'
:
$existEmail
=
UserModel
::
where
(
'email'
,
$email
)
->
exists
();
$existEmail
=
UserModel
::
where
(
'email'
,
$email
)
->
exists
();
if
(
!
$existEmail
)
{
if
(
!
$existEmail
)
{
return
$this
->
setError
(
'This email is not registered'
);
return
$this
->
setError
(
'This email is not registered'
);
}
}
$msg
=
'You are modifying your email address.'
;
break
;
break
;
}
}
...
@@ -216,10 +225,8 @@ class AuthApiController extends Controller
...
@@ -216,10 +225,8 @@ class AuthApiController extends Controller
}
}
Redis
::
set
(
$redisKey
,
$code
);
Redis
::
set
(
$redisKey
,
$code
);
Redis
::
expire
(
$redisKey
,
120
);
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
));
Mail
::
to
(
$email
)
->
send
(
new
SendCode
(
$
code
,
$msg
));
//错误处理
//错误处理
if
(
count
(
Mail
::
failures
()))
{
if
(
count
(
Mail
::
failures
()))
{
return
$this
->
setError
(
'Email code send failed'
);
return
$this
->
setError
(
'Email code send failed'
);
...
...
app/Mail/SendCode.php
View file @
4101e78a
...
@@ -11,18 +11,18 @@ class SendCode extends Mailable
...
@@ -11,18 +11,18 @@ class SendCode extends Mailable
{
{
use
Queueable
,
SerializesModels
;
use
Queueable
,
SerializesModels
;
public
$type
;
public
$code
;
public
$code
;
public
$msg
;
/**
/**
* Create a new message instance.
* Create a new message instance.
*
*
* @return void
* @return void
*/
*/
public
function
__construct
(
$
type
,
$code
)
public
function
__construct
(
$
code
,
$msg
)
{
{
$this
->
type
=
$type
;
$this
->
code
=
$code
;
$this
->
code
=
$code
;
$this
->
msg
=
$msg
;
}
}
/**
/**
...
...
resources/views/emails/code.blade.php
View file @
4101e78a
...
@@ -10,33 +10,14 @@
...
@@ -10,33 +10,14 @@
<div>
<div>
<img
style=
"width: 25%;"
src=
"https://img.ichunt.com/images/ichunt/202211/22/c0a944d0d89fde3ba67477369eac1bb2.png"
>
<img
style=
"width: 25%;"
src=
"https://img.ichunt.com/images/ichunt/202211/22/c0a944d0d89fde3ba67477369eac1bb2.png"
>
</div>
</div>
@if($type=='register')
<div
style=
"margin-top: 50px"
>
<div
style=
"margin-top: 50px"
>
<p>
Hi!
</p>
<p>
Hi!
</p>
<p>
You are registering an account with us.
</p>
<p>
{{$msg}}
</p>
<p>
You can enter this code on SEMOUR website:
</p>
<p>
You can enter this code on SEMOUR website:
</p>
<span
style=
"font-size: 20px"
><strong>
{{$code}}
</strong></span>
<span
style=
"font-size: 20px"
><strong>
{{$code}}
</strong></span>
<p>
If this was not you, please let us know at INFO@semour.com
</p>
<p>
If this was not you, please let us know at INFO@semour.com
</p>
</div>
</div>
@endif
@if($type=='update_email')
<div
style=
"margin-top: 50px"
>
<p>
Hi!
</p>
<p>
You are modifying your email address.
</p>
<p>
You can enter this code on SEMOUR website:
</p>
<span
style=
"font-size: 20px"
><strong>
{{$code}}
</strong></span>
<p>
If this was not you, please let us know at INFO@semour.com
</p>
</div>
@endif
@if($type=='reset_password')
<div
style=
"margin-top: 50px"
>
<p>
Hi!
</p>
<p>
You are trying to reset your password.
</p>
<p>
You can enter this code on SEMOUR website:
</p>
<span
style=
"font-size: 20px"
><strong>
{{$code}}
</strong></span>
<p>
If this was not you, please let us know at INFO@semour.com
</p>
</div>
@endif
</div>
</div>
</body>
</body>
...
...
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