added outlook mail support
This commit is contained in:
@@ -61,6 +61,8 @@ class Settings extends Page implements HasForms
|
||||
'gmailUsernames' => 'gmailUsername',
|
||||
'premium_domains' => 'premium_domain',
|
||||
'premium_gmailUsernames' => 'premium_gmailUsername',
|
||||
'outlookUsernames' => 'outlookUsername',
|
||||
'premium_outlookUsernames' => 'premium_outlookUsername',
|
||||
'forbidden_ids' => 'forbidden_id',
|
||||
'blocked_domains' => 'blocked_domain',
|
||||
];
|
||||
@@ -272,6 +274,24 @@ class Settings extends Page implements HasForms
|
||||
]),
|
||||
]),
|
||||
|
||||
Section::make('Public & Premium Outlook.com Usernames')
|
||||
->collapsed()
|
||||
->columns(2)
|
||||
->schema([
|
||||
Repeater::make('configuration_settings.outlookUsernames')
|
||||
->statePath('configuration_settings.outlookUsernames')
|
||||
->columnSpan(1)
|
||||
->schema([
|
||||
TextInput::make('outlookUsername')->label('Public Outlook Username')->required()->maxLength(30),
|
||||
]),
|
||||
Repeater::make('configuration_settings.premium_outlookUsernames')
|
||||
->statePath('configuration_settings.premium_outlookUsernames')
|
||||
->columnSpan(1)
|
||||
->schema([
|
||||
TextInput::make('premium_outlookUsername')->label('Premium Outlook Username')->required()->maxLength(30),
|
||||
]),
|
||||
]),
|
||||
|
||||
Section::make('Mailbox Configuration')
|
||||
->collapsed()
|
||||
->schema([
|
||||
@@ -394,6 +414,8 @@ class Settings extends Page implements HasForms
|
||||
'premium_domains' => 'premium_domain',
|
||||
'premium_gmailUsernames' => 'premium_gmailUsername',
|
||||
'gmailUsernames' => 'gmailUsername',
|
||||
'outlookUsernames' => 'outlookUsername',
|
||||
'premium_outlookUsernames' => 'premium_outlookUsername',
|
||||
'forbidden_ids' => 'forbidden_id',
|
||||
'blocked_domains' => 'blocked_domain'
|
||||
];
|
||||
|
||||
@@ -201,6 +201,18 @@ class Inbox extends Component
|
||||
return redirect()->route('dashboard.premium');
|
||||
}
|
||||
|
||||
public function outlook() {
|
||||
if (!$this->checkEmailLimit()) {
|
||||
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
|
||||
}
|
||||
if ($this->premium) {
|
||||
$this->email = Premium::generateRandomOutlook();
|
||||
} else {
|
||||
$this->email = ZEmail::generateRandomOutlook();
|
||||
}
|
||||
return redirect()->route('dashboard.premium');
|
||||
}
|
||||
|
||||
public function deleteEmail()
|
||||
{
|
||||
return redirect()->route('deleteP', ['email' => $this->email]);
|
||||
|
||||
@@ -59,6 +59,14 @@ class Action extends Component
|
||||
return redirect()->route('mailbox');
|
||||
}
|
||||
|
||||
public function outlook() {
|
||||
if (!$this->checkEmailLimit()) {
|
||||
return $this->showAlert('error', __('You have reached daily limit of maximum ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail addresses.'));
|
||||
}
|
||||
$this->email = ZEmail::generateRandomOutlook();
|
||||
return redirect()->route('mailbox');
|
||||
}
|
||||
|
||||
public function deleteEmail()
|
||||
{
|
||||
return redirect()->route('delete', ['email' => $this->email]);
|
||||
|
||||
@@ -240,6 +240,7 @@ class Premium extends Model
|
||||
$settings = json_decode(config('app.settings.configuration_settings'), true);
|
||||
$forbidden_ids = $settings['forbidden_ids'] ?? [];
|
||||
$gmail_usernames = $settings['premium_gmailUsernames'] ?? [];
|
||||
$outlook_usernames = $settings['premium_outlookUsernames'] ?? [];
|
||||
$domains = $settings['premium_domains'] ?? [];
|
||||
|
||||
if (in_array($username, $forbidden_ids)) {
|
||||
@@ -250,13 +251,31 @@ class Premium extends Model
|
||||
return self::generateRandomGmail(true);
|
||||
}
|
||||
|
||||
if ($username === '' && in_array($domain, ['outlook.com'])) {
|
||||
return self::generateRandomOutlook(true);
|
||||
}
|
||||
|
||||
$zemail = new Premium();
|
||||
|
||||
if ($username === '' && in_array($domain, $domains)) {
|
||||
return $zemail->generateRandomUsername().'@'.$domain;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['outlook.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
[$check_username, $post_username] = explode('+', $username, 2);
|
||||
|
||||
if (in_array($check_username, $outlook_usernames)) {
|
||||
$email = $username . '@' . $domain;
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $post_username . '@' . $domain;
|
||||
}
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $username . '@' . $domain;
|
||||
}
|
||||
self::storeEmail($email);
|
||||
return $email;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['gmail.com', 'googlemail.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
@@ -314,7 +333,10 @@ class Premium extends Model
|
||||
} else {
|
||||
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
|
||||
}
|
||||
} else {
|
||||
} elseif ($domain == "outlook.com") {
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
}
|
||||
else {
|
||||
$email = $zemail->generateRandomUsername() . '@' . $domain;
|
||||
}
|
||||
if ($store) {
|
||||
@@ -358,6 +380,16 @@ class Premium extends Model
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function generateRandomOutlook($store = true): string
|
||||
{
|
||||
$zemail = new Premium();
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
if ($store) {
|
||||
self::storeEmail($email);
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
private static function storeEmail($email): void
|
||||
{
|
||||
Log::create([
|
||||
@@ -410,6 +442,11 @@ class Premium extends Model
|
||||
$count = count($gmailusername);
|
||||
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
||||
}
|
||||
private function getRandomOutlookUser() {
|
||||
$outlook_username = json_decode(config('app.settings.configuration_settings'))->premium_outlookUsernames ?? [];
|
||||
$count = count($outlook_username);
|
||||
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
||||
}
|
||||
private function generatePronounceableWord(): string
|
||||
{
|
||||
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
|
||||
|
||||
@@ -114,6 +114,7 @@ class ZEmail extends Model
|
||||
$settings = json_decode(config('app.settings.configuration_settings'), true);
|
||||
$forbidden_ids = $settings['forbidden_ids'] ?? [];
|
||||
$gmail_usernames = $settings['gmailUsernames'] ?? [];
|
||||
$outlook_usernames = $settings['outlookUsernames'] ?? [];
|
||||
$domains = $settings['domains'] ?? [];
|
||||
|
||||
if (in_array($username, $forbidden_ids)) {
|
||||
@@ -124,13 +125,31 @@ class ZEmail extends Model
|
||||
return ZEmail::generateRandomGmail(true);
|
||||
}
|
||||
|
||||
if ($username === '' && in_array($domain, ['outlook.com'])) {
|
||||
return ZEmail::generateRandomOutlook(true);
|
||||
}
|
||||
|
||||
$zemail = new ZEmail();
|
||||
|
||||
if ($username === '' && in_array($domain, $domains)) {
|
||||
return $zemail->generateRandomUsername().'@'.$domain;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['outlook.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
[$check_username, $post_username] = explode('+', $username, 2);
|
||||
|
||||
if (in_array($check_username, $outlook_usernames)) {
|
||||
$email = $username . '@' . $domain;
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $post_username . '@' . $domain;
|
||||
}
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $username . '@' . $domain;
|
||||
}
|
||||
ZEmail::storeEmail($email);
|
||||
return $email;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['gmail.com', 'googlemail.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
@@ -190,7 +209,10 @@ class ZEmail extends Model
|
||||
} else {
|
||||
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
|
||||
}
|
||||
} else {
|
||||
} elseif ($domain == "outlook.com") {
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
}
|
||||
else {
|
||||
$email = $zemail->generateRandomUsername() . '@' . $domain;
|
||||
}
|
||||
if ($store) {
|
||||
@@ -235,6 +257,15 @@ class ZEmail extends Model
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function generateRandomOutlook($store = true): string
|
||||
{
|
||||
$zemail = new ZEmail();
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
if ($store) {
|
||||
ZEmail::storeEmail($email);
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
private static function storeEmail($email): void
|
||||
{
|
||||
Log::create([
|
||||
@@ -292,6 +323,11 @@ class ZEmail extends Model
|
||||
$count = count($gmailusername);
|
||||
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
||||
}
|
||||
private function getRandomOutlookUser() {
|
||||
$outlook_username = json_decode(config('app.settings.configuration_settings'))->outlookUsernames ?? [];
|
||||
$count = count($outlook_username);
|
||||
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
||||
}
|
||||
|
||||
private function generatePronounceableWord(): string
|
||||
{
|
||||
|
||||
@@ -36,6 +36,30 @@
|
||||
background-color: #00AB55;
|
||||
}
|
||||
|
||||
.btn-outlook {
|
||||
background-color: #0078D4; /* Outlook blue */
|
||||
color: white;
|
||||
border: 2px solid #0078D4;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-outlook:hover {
|
||||
background-color: #005a9e; /* Darker blue on hover */
|
||||
border-color: #005a9e;
|
||||
}
|
||||
|
||||
.btn-gmail {
|
||||
color: white;
|
||||
background-color: #D93025; /* Gmail red */
|
||||
border: 2px solid #D93025;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-gmail:hover {
|
||||
background-color: #A52714; /* Darker red on hover */
|
||||
border-color: #A52714;
|
||||
}
|
||||
|
||||
.iframe-min-height {
|
||||
min-height: 70vh;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="w-1/2">
|
||||
<livewire:frontend.action action="random" />
|
||||
<livewire:frontend.action action="outlook" />
|
||||
</div>
|
||||
<div class="w-1/2">
|
||||
<livewire:frontend.action action="gmail" />
|
||||
|
||||
@@ -62,7 +62,12 @@
|
||||
|
||||
<div class="flex my-6">
|
||||
<div class="flex w-full">
|
||||
<flux:button class="w-full btn-success cursor-pointer" type="submit" variant="primary">{{ __('Create') }}</flux:button>
|
||||
<div class="w-1/2">
|
||||
<flux:button wire:click="random()" class="cursor-pointer w-full btn-warning" variant="filled">{{ __('Random') }} Email</flux:button>
|
||||
</div>
|
||||
<div class="w-1/2">
|
||||
<flux:button class="w-full ml-2 btn-success cursor-pointer" type="submit" variant="primary">{{ __('Create') }}</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -71,10 +76,10 @@
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="w-1/2">
|
||||
<flux:button wire:click="random()" class="cursor-pointer w-full btn-primary" type="submit" variant="filled">{{ __('Random') }} Email</flux:button>
|
||||
<flux:button wire:click="outlook()" class="cursor-pointer w-full btn-outlook" type="submit" variant="filled">Disposable Gmail</flux:button>
|
||||
</div>
|
||||
<div class="w-1/2">
|
||||
<flux:button wire:click="gmail()" class="cursor-pointer w-full ml-2 btn-warning" type="submit" variant="filled">Disposable Gmail</flux:button>
|
||||
<flux:button wire:click="gmail()" class="cursor-pointer w-full ml-2 btn-gmail" type="submit" variant="filled">Disposable Gmail</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
@if($action == "random")
|
||||
<flux:button wire:click="random()" class="cursor-pointer w-full btn-primary" type="submit" variant="filled">{{ __('Random') }} Email</flux:button>
|
||||
@elseif($action == "gmail")
|
||||
<flux:button wire:click="gmail()" class="cursor-pointer w-full ml-2 btn-warning" type="submit" variant="filled">Disposable Gmail</flux:button>
|
||||
<flux:button wire:click="gmail()" class="cursor-pointer w-full ml-2 btn-gmail" type="submit" variant="filled">Disposable Gmail</flux:button>
|
||||
@elseif($action == "outlook")
|
||||
<flux:button wire:click="outlook()" class="cursor-pointer w-full btn-outlook" type="submit" variant="filled">Disposable Outlook</flux:button>
|
||||
@elseif($action == "delete")
|
||||
<flux:button wire:click="deleteEmail()" class="cursor-pointer" type="submit" variant="danger">{{ __('Delete') }}</flux:button>
|
||||
@elseif($action == "customEmail")
|
||||
@@ -32,7 +34,8 @@
|
||||
|
||||
<div class="flex my-6">
|
||||
<div class="flex w-full">
|
||||
<flux:button x-on:click="$dispatch('closeModal')" class="w-1/2 cursor-pointer" variant="outline">{{ __('Cancel') }}</flux:button>
|
||||
{{-- <flux:button x-on:click="$dispatch('closeModal')" class="w-1/2 cursor-pointer" variant="outline">{{ __('Cancel') }}</flux:button>--}}
|
||||
<flux:button wire:click="random()" class="cursor-pointer w-1/2 btn-warning" variant="filled">{{ __('Random') }} Email</flux:button>
|
||||
<flux:button class="ml-2 w-1/2 btn-success cursor-pointer" type="submit" variant="primary">{{ __('Create') }}</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user