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
430e09f8
authored
Nov 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
对接正式的邮箱
parent
26f30dfa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
8 deletions
app/Http/Controllers/Api/AuthApiController.php
app/Mail/SendCode.php
public/assets/images/email/logo.png
resources/views/emails/code.blade.php
app/Http/Controllers/Api/AuthApiController.php
View file @
430e09f8
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use
App\Http\Requests\UserRegister
;
use
App\Http\Requests\UserRegister
;
use
App\Http\Services\UserService
;
use
App\Http\Services\UserService
;
use
App\Mail\SendCode
;
use
App\Models\UserModel
;
use
App\Models\UserModel
;
use
Illuminate\Foundation\Auth\RegistersUsers
;
use
Illuminate\Foundation\Auth\RegistersUsers
;
use
Illuminate\Foundation\Auth\ThrottlesLogins
;
use
Illuminate\Foundation\Auth\ThrottlesLogins
;
...
@@ -195,8 +196,7 @@ class AuthApiController extends Controller
...
@@ -195,8 +196,7 @@ class AuthApiController extends Controller
if
(
!
$existEmail
)
{
if
(
!
$existEmail
)
{
return
$this
->
setError
(
'This email is not registered'
);
return
$this
->
setError
(
'This email is not registered'
);
}
}
break
;
break
;
}
}
...
@@ -209,12 +209,8 @@ class AuthApiController extends Controller
...
@@ -209,12 +209,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'
);
$subject
=
config
(
'mail.from.name'
);
$msg
=
'Email Code:'
.
$code
.
'.'
;
// return $this->setSuccessData($code);
return
$this
->
setSuccessData
(
$code
);
Mail
::
to
(
$email
)
->
send
(
new
SendCode
(
$type
,
$code
));
Mail
::
raw
(
$msg
,
function
(
$message
)
use
(
$email
,
$subject
)
{
$message
->
to
(
$email
)
->
subject
(
$subject
);
});
//错误处理
//错误处理
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
0 → 100644
View file @
430e09f8
<?php
namespace
App\Mail
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Mail\Mailable
;
use
Illuminate\Queue\SerializesModels
;
class
SendCode
extends
Mailable
{
use
Queueable
,
SerializesModels
;
public
$type
;
public
$code
;
/**
* Create a new message instance.
*
* @return void
*/
public
function
__construct
(
$type
,
$code
)
{
$this
->
type
=
$type
;
$this
->
code
=
$code
;
}
/**
* Build the message.
*
* @return $this
*/
public
function
build
()
{
return
$this
->
view
(
'emails.code'
);
}
}
public/assets/images/email/logo.png
0 → 100644
View file @
430e09f8
11.8 KB
resources/views/emails/code.blade.php
View file @
430e09f8
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
菜鸟教程(runoob.com)
</title>
</head>
<body>
<div
style=
"padding: 100px"
>
<div>
<img
style=
"width: 25%;"
src=
"https://img.ichunt.com/images/ichunt/202211/22/c0a944d0d89fde3ba67477369eac1bb2.png"
>
</div>
@if($type=='register')
<div
style=
"margin-top: 50px"
>
<p>
Hi!
</p>
<p>
You are registering an account with us.
</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=='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>
</body>
</html>
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