Checks whether or not the email address is already verified
        beyond allauth scope, for example, by having accepted an
        invitation before signing up.
542911
def is_email_verified(self, request, email):
        
        ret = False
        verified_email = request.session.get('account_verified_email')
        if verified_email:
            ret = verified_email.lower() == email.lower()
        return ret
809210
def clean_email(self):
        
        email = self.cleaned_data.get("email")
        qs = User.objects.exclude(id=self.instance.id).filter(email=email)
        if len(qs) == 0:
            return email
        raise forms.ValidationError(
                                ugettext("This email is already registered"))
564243
def _check_email_match(self, user, email):
        
        if user.email != email:
            # The passed email address doesn't match this username's email address.
            # Assume a problem and fail.
            raise CommandError(
                _(
                    'Skipping user "{}" because the specified and existing email '
                    'addresses do not match.'
                ).format(user.username)
            )
1335395
def CheckEmail(self, email, checkTypo=False):
        ''''''
        contents = email.split('@')
        if len(contents) == 2:
            if contents[1] in self.valid:
                return True
        return False
807152
private function verify_email() {
            $this->_handle_account_user_sync();

            if ( $this->_user->is_verified() ) {
                return;
            }

            $api    = $this->get_api_site_scope();
            $result = $api->call( "/users/{$this->_user->id}/verify.json", 'put', array(
                'after_email_confirm_url' => $this->_get_admin_page_url(
                    'account',
                    array( 'fs_action' => 'sync_user' )
                )
            ) );

            if ( ! isset( $result->error ) ) {
                $this->_admin_notices->add( sprintf(
                    $this->get_text_inline( 'Verification mail was just sent to %s. If you can\'t find it after 5 min, please check your spam box.', 'verification-email-sent-message' ),
                    sprintf( '<a href="mailto:%1s">%2s</a>', esc_url( $this->_user->email ), $this->_user->email )
                ) );
            } else {
                // handle different error cases.

            }
        }
1238305
public static boolean isValidEmailAddress(final String email) {
    if (email == null) {
      return false;
    }

    boolean result = true;
    try {
      final InternetAddress emailAddr = new InternetAddress(email);
      emailAddr.validate();
    } catch (final AddressException ex) {
      result = false;
    }
    return result;
  }
969764
def clean_email(self):
        
        if EMAIL_CONFIRMATION:
            from .models import EmailAddress
            condition = EmailAddress.objects.filter(
                email__iexact=self.cleaned_data["email"],
                verified=True
            ).count() == 0
        else:
            condition = User.objects.get(
                email__iexact=self.cleaned_data["email"],
                is_active=True
            ).count() == 0

        if condition is True:
            raise forms.ValidationError(
                _("Email address not verified for any user account")
            )
        return self.cleaned_data["email"]
55597
def valid_email(emailaddress, domains=GENERIC_DOMAINS):
    """"""

    # Email address must be at least 6 characters in total.
    # Assuming noone may have addresses of the type a@com
    if len(emailaddress) < 6:
        return False  # Address too short.

    # Split up email address into parts.
    try:
        localpart, domainname = emailaddress.rsplit('@', 1)
        host, toplevel = domainname.rsplit('.', 1)
    except ValueError:
        return False  # Address does not have enough parts.

    # Check for Country code or Generic Domain.
    if len(toplevel) != 2 and toplevel not in domains:
        return False  # Not a domain name.

    for i in '-_.%+.':
        localpart = localpart.replace(i, "")
    for i in '-_.':
        host = host.replace(i, "")

    if localpart.isalnum() and host.isalnum():
        return True  # Email address is fine.
    else:
        return False
1009410
def update_alias_verification(sender, instance, **kwargs):
    
    if isinstance(instance, User):

        if instance.id:

            if api_settings.PASSWORDLESS_USER_MARK_EMAIL_VERIFIED is True:
                """
                For marking email aliases as not verified when a user changes it.
                """
                email_field = api_settings.PASSWORDLESS_USER_EMAIL_FIELD_NAME
                email_verified_field = api_settings.PASSWORDLESS_USER_EMAIL_VERIFIED_FIELD_NAME

                # Verify that this is an existing instance and not a new one.
                try:
                    user_old = User.objects.get(id=instance.id)  # Pre-save object
                    instance_email = getattr(instance, email_field)  # Incoming Email
                    old_email = getattr(user_old, email_field)  # Pre-save object email

                    if instance_email != old_email and instance_email != "" and instance_email is not None:
                        # Email changed, verification should be flagged
                        setattr(instance, email_verified_field, False)
                        if api_settings.PASSWORDLESS_AUTO_SEND_VERIFICATION_TOKEN is True:
                            email_subject = api_settings.PASSWORDLESS_EMAIL_VERIFICATION_SUBJECT
                            email_plaintext = api_settings.PASSWORDLESS_EMAIL_VERIFICATION_PLAINTEXT_MESSAGE
                            email_html = api_settings.PASSWORDLESS_EMAIL_VERIFICATION_TOKEN_HTML_TEMPLATE_NAME
                            message_payload = {'email_subject': email_subject,
                                               'email_plaintext': email_plaintext,
                                               'email_html': email_html}
                            success = TokenService.send_token(instance, 'email', **message_payload)

                            if success:
                                logger.info('drfpasswordless: Successfully sent email on updated address: %s'
                                            % instance_email)
                            else:
                                logger.info('drfpasswordless: Failed to send email to updated address: %s'
                                            % instance_email)

                except User.DoesNotExist:
                    # User probably is just initially being created
                    setattr(instance, email_verified_field, True)

            if api_settings.PASSWORDLESS_USER_MARK_MOBILE_VERIFIED is True:
                """
                For marking mobile aliases as not verified when a user changes it.
                """
                mobile_field = api_settings.PASSWORDLESS_USER_MOBILE_FIELD_NAME
                mobile_verified_field = api_settings.PASSWORDLESS_USER_MOBILE_VERIFIED_FIELD_NAME

                # Verify that this is an existing instance and not a new one.
                try:
                    user_old = User.objects.get(id=instance.id)  # Pre-save object
                    instance_mobile = getattr(instance, mobile_field)  # Incoming mobile
                    old_mobile = getattr(user_old, mobile_field)  # Pre-save object mobile

                    if instance_mobile != old_mobile and instance_mobile != "" and instance_mobile is not None:
                        # Mobile changed, verification should be flagged
                        setattr(instance, mobile_verified_field, False)
                        if api_settings.PASSWORDLESS_AUTO_SEND_VERIFICATION_TOKEN is True:
                            mobile_message = api_settings.PASSWORDLESS_MOBILE_MESSAGE
                            message_payload = {'mobile_message': mobile_message}
                            success = TokenService.send_token(instance, 'mobile', **message_payload)

                            if success:
                                logger.info('drfpasswordless: Successfully sent SMS on updated mobile: %s'
                                            % instance_mobile)
                            else:
                                logger.info('drfpasswordless: Failed to send SMS to updated mobile: %s'
                                            % instance_mobile)

                except User.DoesNotExist:
                    # User probably is just initially being created
                    setattr(instance, mobile_verified_field, True)
947930
def verify(self, **kwargs):
        
        super(RegistrationResponse, self).verify(**kwargs)

        has_reg_uri = "registration_client_uri" in self
        has_reg_at = "registration_access_token" in self
        if has_reg_uri != has_reg_at:
            raise VerificationError((
                "Only one of registration_client_uri"
                " and registration_access_token present"), self)

        return True
1125676
def verified(self):
        
        for who, record in self.logs:
            if record["field_name"] == "status" \
                    and record["added"] == "VERIFIED":
                return True
        return False
1328621
def is_valid(self):
        ''' 
        '''
        if not super(AddUserForm, self).is_valid():
            return False
        first_name = self.cleaned_data['first_name']
        last_name = self.cleaned_data['last_name']
        if User.objects.filter(first_name=first_name, last_name=last_name).count():
            non_field_error = "A profile for {0} {1} already exists with username {2}." \
              .format(first_name, last_name,
                      User.objects.get(first_name=first_name, last_name=last_name).username)
            form_add_error(self, '__all__', non_field_error)
            return False
        if self.cleaned_data['user_password'] != self.cleaned_data['confirm_password']:
            form_add_error(self, 'user_password', "Passwords don't match.")
            form_add_error(self, 'confirm_password', "Passwords don't match.")
            return False
        return True
381899
def get_valid_user_by_email(email):
    
    user = get_user(email)
    if user:
        if user.valid is False:
            return Err("user not valid")
        return Ok(user)
    return Err("user not exists")
171451
def is_email_valid(email):
    
    pattern = re.compile(r'[\w\.-]+@[\w\.-]+[.]\w+')
    return bool(pattern.match(email))
921500
def verify_create(self, recipient, params=None):
        """"""
        if params is None: params = {}
        params.update({'recipient': recipient})
        return Verify().load(self.request('verify', 'POST', params))
191654
def same_as?(other_email)
      if other_email.is_a?(String)
        other_email = EmailAddress::Address.new(other_email)
      end

      self.canonical   == other_email.canonical ||
        self.redact    == other_email.canonical ||
        self.canonical == other_email.redact
    end
1083445
def _is_logged_in_with_confirmed_email(user_manager):
    
    # User must be logged in
    if user_manager.call_or_get(current_user.is_authenticated):
        # Is unconfirmed email allowed for this view by @allow_unconfirmed_email?
        unconfirmed_email_allowed = \
            getattr(g, '_flask_user_allow_unconfirmed_email', False)
        
        # unconfirmed_email_allowed must be True or
        # User must have at least one confirmed email address
        if unconfirmed_email_allowed or user_manager.db_manager.user_has_confirmed_email(current_user):
            return True

    return False