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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user