Merge remote-tracking branch 'origin/master'

This commit is contained in:
merdan 2022-12-07 18:18:20 +05:00
commit 43701c0c37
13 changed files with 285 additions and 283 deletions

View File

@ -8,7 +8,6 @@
use App\Http\Requests\API\ClientRequest;
use App\Http\Resources\ClientResource;
use App\Mail\EmailVerification;
use App\Mail\ResetPassword;
use App\Models\Account;
use App\Models\Client;
use Illuminate\Http\Request;
@ -18,7 +17,8 @@
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
{
@ -70,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([
@ -88,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;
@ -156,7 +146,7 @@ public function sendPasswordResetLinkEmail(Request $request) {
$token = rand(1000, 9999);
Mail::to($request->email)->queue(new ResetPassword($user->firstname, $token));
$user->notify(new PasswordReset($user->firstname, $token));
$user['verification_token'] = $token;

View File

@ -1,33 +0,0 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ApplicationApproved extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('view.name');
}
}

View File

@ -1,33 +0,0 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ApplicationRefined extends Mailable
{
use Queueable, SerializesModels;
public $name;
public function __construct($name)
{
$this->name = $name;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$user['name'] = $this->name;
return $this->subject('Your application has been refined!')
->view('emails.notifications.application_refined', ['user' => $user]);
}
}

View File

@ -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]);
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ResetPassword 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('Resetting your password')
->view('emails.reset-password', ['user' => $user]);
}
}

View File

@ -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');
}
/**

View File

@ -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');
}
/**

View File

@ -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 [
//
];
}
}

View File

@ -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 PasswordReset 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('Resetting your password')
->view('emails.reset-password', ['user' => $user]);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}

View File

@ -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');
}
/**

View File

@ -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');
}
/**

View File

@ -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>

View File

@ -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>