email verification done
This commit is contained in:
parent
cb800a802f
commit
9901bca9dc
|
|
@ -17,6 +17,7 @@
|
|||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Notifications\EmailVerify;
|
||||
use App\Notifications\PasswordReset;
|
||||
|
||||
class ClientController extends Controller
|
||||
|
|
@ -69,16 +70,7 @@ public function signup(RegisterRequest $request){
|
|||
if($email_verification)
|
||||
{
|
||||
$client->verification_token = rand(10000, 99999);
|
||||
|
||||
//try{
|
||||
Mail::to($request->email)
|
||||
->queue(new EmailVerification($request->firstname, $client->verification_token));
|
||||
// }catch (\Exception $ex){
|
||||
// //eger email ugradyp bolmasa verification edip bolmaz
|
||||
// $client->is_verified = true;
|
||||
// Log::error($ex->getMessage());
|
||||
// }
|
||||
|
||||
$client->notify(new EmailVerify($request->firstname, $client->verification_token));
|
||||
}
|
||||
|
||||
$account = Account::create([
|
||||
|
|
@ -87,7 +79,6 @@ public function signup(RegisterRequest $request){
|
|||
]);
|
||||
|
||||
$client->account()->associate($account)->save();
|
||||
|
||||
if($client->is_verified){
|
||||
Auth::login($client);
|
||||
$client->token = $client->createToken('auth_token')->plainTextToken;
|
||||
|
|
@ -157,8 +148,6 @@ public function sendPasswordResetLinkEmail(Request $request) {
|
|||
|
||||
$user->notify(new PasswordReset($user->firstname, $token));
|
||||
|
||||
//Mail::to($request->email)->queue(new ResetPassword());
|
||||
|
||||
$user['verification_token'] = $token;
|
||||
|
||||
$user->save();
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class EmailVerification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public $name;
|
||||
public $token;
|
||||
|
||||
public function __construct($name, $token)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$user['name'] = $this->name;
|
||||
$user['token'] = $this->token;
|
||||
|
||||
return $this->subject('Verify your email')
|
||||
->view('emails.email-verification', ['user' => $user]);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,8 @@ public function via($notifiable)
|
|||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)->view('emails.notifications.application_approved');
|
||||
return (new MailMessage)->subject('Application approved!')
|
||||
->view('emails.notifications.application_approved');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ public function via($notifiable)
|
|||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)->view('emails.notifications.application_refined');
|
||||
return (new MailMessage)->subject('Application refined!')
|
||||
->view('emails.notifications.application_refined');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class EmailVerify extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public $name;
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $token)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$user['name'] = $this->name;
|
||||
$user['token'] = $this->token;
|
||||
|
||||
return (new MailMessage)->subject('Verify your email')
|
||||
->view('emails.email-verification', ['user' => $user]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,8 @@ public function via($notifiable)
|
|||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)->view('emails.notifications.new_message');
|
||||
return (new MailMessage)->subject('You have new message!')
|
||||
->view('emails.notifications.new_message');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ public function via($notifiable)
|
|||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)->view('emails.notifications.new_ticket');
|
||||
return (new MailMessage)->subject('New ticket created.')
|
||||
->view('emails.notifications.new_ticket');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,71 +1,84 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<style>
|
||||
table,
|
||||
td,
|
||||
div,
|
||||
h1,
|
||||
p {
|
||||
font-weight: 500;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
.btn {margin: 10px 0px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
color: #fff !important;
|
||||
height: 46px;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
background-image: linear-gradient(to right top, #021d68, #052579, #072d8b, #09369d, #093fb0) !important;
|
||||
}
|
||||
.btn:hover {
|
||||
text-decoration: none;
|
||||
opacity: .8;
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap" rel="stylesheet">
|
||||
<title>Email template</title>
|
||||
<style type="text/css">
|
||||
@media screen and (max-width: 450px) {
|
||||
.title {
|
||||
width: calc(100% - 54px);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td style="padding:0;">
|
||||
<table role="presentation" style="width:600px;border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;text-align:left;">
|
||||
|
||||
<body style="font-family: 'Poppins', sans-serif;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
line-height: 1.4;
|
||||
font-weight: 400;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-font-smoothing: antialiased;">
|
||||
|
||||
|
||||
<div id="wrapper" style=" margin: 10px;">
|
||||
<div class="inner">
|
||||
|
||||
<table class="mail"
|
||||
style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
||||
<thead style="background-color: #003197;">
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<p style="font-weight:bold;margin:0 0 20px 0;font-family:Arial,sans-serif;">
|
||||
Hello {{ $user ? $user['name'] : '' }},</h1>
|
||||
<p
|
||||
style="margin:0 0 12px 0;font-size:14px;line-height:24px;font-family:Arial,sans-serif;">
|
||||
Verify your email address!
|
||||
</p>
|
||||
<p
|
||||
style="margin:10px 0 12px 0;font-size:14px;line-height:24px;font-family:Arial,sans-serif;">
|
||||
Your code to verify email:
|
||||
</p>
|
||||
<th class="header" style="padding: 0; position: relative;">
|
||||
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
||||
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
||||
<img style=" width: 100%; height: 100%; object-fit: contain; -o-object-fit: contain;" src="https://panel.exchange.gov.tm/img/mini-logo.png" alt="logo">
|
||||
</div>
|
||||
|
||||
<p style="text-align: center;">
|
||||
{{$user['token']}}
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1 class="title" style="font-size: 16px; text-align: left; font-weight: 700; line-height: 1.5; color: #fff; width: calc(100% - 60px);">
|
||||
Подтверждение адреса электронной почты
|
||||
</h1>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="content">
|
||||
<tr>
|
||||
<td style="padding: 30px 0 0 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4; margin-bottom: 15px;">
|
||||
Здравствуйте!
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td style="padding: 0 20px 0 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4; margin-bottom: 15px;">
|
||||
Вы указали текущий адрес электронной почты для регистрации в личном кабинете на сайте ГТСБТ. <br>
|
||||
Чтобы закончить регистрацию, подтвердите свой e-mail. Код подтверждения: {{$user['token']}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0 20px 30px 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4;">
|
||||
С уважением, <br>
|
||||
отдел фин. мониторинга ГТСБТ.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,71 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<style>
|
||||
table,
|
||||
td,
|
||||
div,
|
||||
h1,
|
||||
p {
|
||||
font-weight: 500;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
.btn {margin: 10px 0px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
color: #fff !important;
|
||||
height: 46px;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
background-image: linear-gradient(to right top, #021d68, #052579, #072d8b, #09369d, #093fb0) !important;
|
||||
}
|
||||
.btn:hover {
|
||||
text-decoration: none;
|
||||
opacity: .8;
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap" rel="stylesheet">
|
||||
<title>Email template</title>
|
||||
<style type="text/css">
|
||||
@media screen and (max-width: 450px) {
|
||||
.title {
|
||||
width: calc(100% - 54px);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td style="padding:0;">
|
||||
<table role="presentation" style="width:600px;border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;text-align:left;">
|
||||
|
||||
<body style="font-family: 'Poppins', sans-serif;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
line-height: 1.4;
|
||||
font-weight: 400;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-font-smoothing: antialiased;">
|
||||
|
||||
|
||||
<div id="wrapper" style=" margin: 10px;">
|
||||
<div class="inner">
|
||||
|
||||
<table class="mail"
|
||||
style="border: 1px solid #003197; border-radius: 5px; overflow: hidden; width: 100%; border-spacing: 0;">
|
||||
<thead style="background-color: #003197;">
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<p style="font-weight:bold;margin:0 0 20px 0;font-family:Arial,sans-serif;">
|
||||
Hello {{ $user ? $user['name'] : '' }},</h1>
|
||||
<p
|
||||
style="margin:0 0 12px 0;font-size:14px;line-height:24px;font-family:Arial,sans-serif;">
|
||||
We've received a request to reset the password.
|
||||
</p>
|
||||
<p
|
||||
style="margin:10px 0 12px 0;font-size:14px;line-height:24px;font-family:Arial,sans-serif;">
|
||||
Your code to reset:
|
||||
</p>
|
||||
<th class="header" style="padding: 0; position: relative;">
|
||||
<div class="header_row" style=" display: flex; align-items: center; padding: 10px 20px;">
|
||||
<div class="logo" style="width: 44px; height: 44px; margin-right: 20px; position: relative; z-index: 2;">
|
||||
<img style=" width: 100%; height: 100%; object-fit: contain; -o-object-fit: contain;" src="https://panel.exchange.gov.tm/img/mini-logo.png" alt="logo">
|
||||
</div>
|
||||
|
||||
<p style="text-align: center;">
|
||||
{{$user['token']}}
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1 class="title" style="font-size: 16px; text-align: left; font-weight: 700; line-height: 1.5; color: #fff; width: calc(100% - 60px);">
|
||||
Сброс пароля
|
||||
</h1>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="content">
|
||||
<tr>
|
||||
<td style="padding: 30px 0 0 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4; margin-bottom: 15px;">
|
||||
Здравствуйте!
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td style="padding: 0 20px 0 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4; margin-bottom: 15px;">
|
||||
Код для сброса пароля: {{$user['token']}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0 20px 30px 20px;">
|
||||
<p class="content_txt" style="font-size: 14px; font-weight: 400; line-height: 1.4;">
|
||||
С уважением, <br>
|
||||
отдел фин. мониторинга ГТСБТ.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue