0

in osticket version 1.10, i wish to apply a validation rule on email input field so that users with email id only from specific domain can open new ticket or apply for registration i.e. email address always should look like id@specificdomain.com . however i tried to edit the is_email() function in includes/class.validator.php as bellow

static function is_email($email, $list=false, $verify=false){
        $domains = array('specificdomain.com');
        $pattern = "/^[a-z0-9._%+-]+@([a-z0-9.-]+.)*(" . implode('|', $domains) . ")$/i"; 
        if (!preg_match($pattern, $email)) {
            return false;
        }

    }

But no use. can any body help me in this regard.

Dilver Singh
  • 103
  • 2
  • 9

2 Answers2

1

Please try this pattern /(\W|^)[\w.+\-]*@specificdomain\.com(\W|$)/

     static function is_email($email, $list=false, $verify=false){        
        $domains = 'specificdomain.com';
        $pattern = "/(\W|^)[\w.+\-]*".$domains."(\W|$)/"; 
          if (!preg_match($pattern, $email)) {
            return FALSE;               
          }else{
            return TRUE;
          }

      }
Rafiqul Islam
  • 1,636
  • 1
  • 12
  • 25
  • ya its good but the problem remains same, user with different domains are able to open the ticket. just want to know is the file i am in includes/class.validator.php is correct file ? – Dilver Singh Mar 02 '17 at 06:21
0

You can create an organization for each domain. Go on Users->Organizations-> define one, then click on its name-> Settings tab-> define the domain

This will allow all the users from that domain to open calls. They will also be added as users underneath the organization page.

If you want to block other domains, you have to go to the admin panel, then settings->users->tick registration required, and select in registration method "only agents can register user". Despite what it seems, if a user is part of the domain he will be able to open a call even if he has not been registered yet.

A bit late, but I hope it will help you.

Pampa Nello
  • 206
  • 5
  • 16