Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: 1 2 [3]

Author Topic: Forum mail problem for those using Microsoft email addresses - Again!  (Read 4736 times)

kitz

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 31559
  • Trinity: Most guys do.
    • http://www.kitz.co.uk
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #30 on: June 15, 2018, 11:24:47 AM »

I think the person above me posted an update, but that failed too.    I had a look at the code and saw that my Subs-Members.php had a totally different set of code rather than just one symbol in the one line.     I was going to download a fresh Subs-Menu and compare to mine to see if it was perhaps another mod (such as Stop Spammer) which had inserted the extra code.    I never got that far though.    As you will see it was earlier this year I started looking at it, but then left it as MS mitigated me.    It's only with it happening again recently that I need to revisit it, but just not had chance yet. 
Logged
Please do not PM me with queries for broadband help as I may not be able to respond.
-----
How to get your router line stats :: ADSL Exchange Checker

kitz

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 31559
  • Trinity: Most guys do.
    • http://www.kitz.co.uk
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #31 on: June 15, 2018, 11:27:06 AM »

If it helps, this is where it fails.


Find
Code: [Select]
// !!! Separate the sprintf?
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email']) === 0 || strlen($regOptions['email']) > 255)
$reg_errors[] = array('done', sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($regOptions['username'])));



Code: (Replace)
Code: [Select]
// Lets restrict some email providers
   if (!empty($modSettings['restricted_provider']))
   {
      $restricted_provider = explode(",", preg_replace("/(\@[^a-zA-Z0-9,])/", "", $modSettings['restricted_provider']));

      foreach ($restricted_provider as $key => $value)
         if (empty($value))
            unset($restricted_provider[$key]);
   }
   else
      $restricted_provider = array();



   if (!empty($modSettings['enable_restrict_EmailProvider']) && !empty($modSettings['restricted_provider']))
   {
      foreach($restricted_provider as $provider)
      {       
         preg_match('/' . $provider . '+/i', $_POST['email'], $matches);
   
         if(count($matches) > 0)
            fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
      }
   }
   
    if (!empty($modSettings['accepted_provider']))
   {
      $accepted_provider = explode(",", preg_replace("/(\@[^a-zA-Z0-9,])/", "", $modSettings['accepted_provider']));

      foreach ($accepted_provider as $akey => $avalue)
         if (empty($avalue))
            unset($accepted_provider[$akey]);
   }
   else
      $accepted_provider = array(); 
   
    if (!empty($modSettings['enable_restrict_EmailProvider']) && !empty($modSettings['accepted_provider']))
   {
      foreach($accepted_provider as $aprovider)
      {       
         preg_match('/' . $aprovider . '+/i', $_POST['email'], $matches);

if(count($accepted_provider) == 1)
{
if(count($matches) == 0)
fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
}
else
{
if(count($matches) == 0 && !(each($accepted_provider)))
fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
}
      }
   }
   // !!! Separate the sprintf?
   elseif (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email']) === 0 || strlen($regOptions['email']) > 255)
$reg_errors[] = array('done', sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($regOptions['username'])));


Logged
Please do not PM me with queries for broadband help as I may not be able to respond.
-----
How to get your router line stats :: ADSL Exchange Checker

kitz

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 31559
  • Trinity: Most guys do.
    • http://www.kitz.co.uk
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #32 on: June 15, 2018, 11:30:32 AM »

This is my Subs-Members.php


Code: [Select]
// !!! Separate the sprintf?
if (empty($regOptions['email']) || filter_var($regOptions['email'], FILTER_VALIDATE_EMAIL) === false || strlen($regOptions['email']) > 255)
$reg_errors[] = array('lang', 'profile_error_bad_email');

if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))
{
if ($regOptions['password'] == 'chocolate cake')
$reg_errors[] = array('done', 'Sorry, I don\'t take bribes... you\'ll need to come up with a different name.');
$reg_errors[] = array('done', '(' . htmlspecialchars($regOptions['username']) . ') ' . $txt['name_in_use']);
}

Logged
Please do not PM me with queries for broadband help as I may not be able to respond.
-----
How to get your router line stats :: ADSL Exchange Checker

Chrysalis

  • Content Team
  • Addicted Kitizen
  • *
  • Posts: 5416
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #33 on: June 15, 2018, 11:58:28 AM »

I will wait to see what Jelv and others come up with before I attempt anything.

But yeah having test accounts is great for things like this so no experimentation done on a live site then.
Logged
Sky Fiber Pro - Billion 8800NL bridge & PFSense BOX running PFSense 2.4 - ECI Cab - LINE STATISTICS CLICK HERE

jelv

  • Helpful
  • Kitizen
  • *
  • Posts: 1025
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #34 on: June 15, 2018, 12:08:45 PM »

I've got a modified version that works on a vanilla SMF installation!
Logged
Line rental: Pulse8, Broadband: AAISP Home::1 FTTC 80/20, Mobile: id Mobile

jelv

  • Helpful
  • Kitizen
  • *
  • Posts: 1025
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #35 on: June 15, 2018, 12:24:15 PM »

PM sent to Kitz with link to modified forum for her to try and my modified package.
John
Logged
Line rental: Pulse8, Broadband: AAISP Home::1 FTTC 80/20, Mobile: id Mobile

kitz

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 31559
  • Trinity: Most guys do.
    • http://www.kitz.co.uk
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #36 on: June 15, 2018, 12:26:50 PM »

Well done you!  :thumbs:


I'm not sure if you've seen reply #133 and not sure if it applies

Quote
Please note if you use this fix you MUST add another string to the code after the elseif... or users can double-register names/emails.

Replace elseif with:

I was also going to look at reply #134

Quote
To prevent the use of a restricted email provider when members change their email address while modifying their profile make the following change to ./Sources/Profile-Modify.php

I have to go out in a few mins, but if you could kindly email me the files and I will test later.



--------------
ETA
Warning - while you were typing a new reply has been posted. You may wish to review your post.

Just seen the further message and the PM.   
Sorry but I really do need to go out now as I have an appt, but will get back to you asap.



Logged
Please do not PM me with queries for broadband help as I may not be able to respond.
-----
How to get your router line stats :: ADSL Exchange Checker

jelv

  • Helpful
  • Kitizen
  • *
  • Posts: 1025
Re: Forum mail problem for those using Microsoft email addresses - Again!
« Reply #37 on: June 15, 2018, 12:34:05 PM »

I hadn't seen those posts.

What I did was compare the source of 2.0.15 with the source of 2.0.1. I could see that the search lines had been totally changed to use a different method of validating the email format, but that the surrounding lines had not been changed. I just replaced the code with the new version in both the search and the add.

Edit: I've looked at 133.

Code: [Select]
elseif (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email']) === 0 || strlen($regOptions['email']) > 255)
is the old version from 2.0.1

Code: [Select]
$reg_errors[] = array('lang', 'profile_error_bad_email');
Looks like a line was omitted by a copy/paste error in the quoted post. That line is in my modified version.
« Last Edit: June 15, 2018, 12:41:50 PM by jelv »
Logged
Line rental: Pulse8, Broadband: AAISP Home::1 FTTC 80/20, Mobile: id Mobile
Pages: 1 2 [3]
 

anything