'Designed to be called when a user is verified through:
- responding to their verification email
- if verification isn\'t required
Does the following:
- Sends a message to the approver to notify them if a user needs approval
- If deployment_settings.auth.always_notify_approver = True,
send them notification regardless
- If approval isn\'t required - calls s3_approve_user
@returns boolean - if the user has been approved'

def s3_verify_user(self, user):

    db = current.db
    deployment_settings = current.deployment_settings
    session = current.session
    utable = self.settings.table_user
    (approver, organisation_id) = self.s3_approver(user)
    if (deployment_settings.get_auth_registration_requires_approval() and approver):
        approved = False
        db((utable.id == user.id)).update(registration_key='pending')
        if user.registration_key:
            session.information = deployment_settings.get_auth_registration_pending_approval()
        else:
            session.information = deployment_settings.get_auth_registration_pending()
        message = 'approve_user'
    else:
        approved = True
        if (organisation_id and (not user.get('organisation_id', None))):
            user['organisation_id'] = organisation_id
            db((utable.id == user.id)).update(organisation_id=organisation_id)
            link_user_to = deployment_settings.get_auth_registration_link_user_to_default()
            if (link_user_to and (not user.get('link_user_to', None))):
                user['link_user_to'] = link_user_to
            self.s3_link_user(user)
        self.s3_approve_user(user)
        session.confirmation = self.messages.email_verified
        session.flash = self.messages.registration_successful
        if (not deployment_settings.get_auth_always_notify_approver()):
            return True
        message = 'new_user'
    if ('@' in approver):
        record = db((utable.email == approver)).select(utable.language, limitby=(0, 1)).first()
        if record:
            language = record.language
        else:
            language = deployment_settings.get_L10n_default_language()
        approvers = [{'email': approver, 'language': language}]
        languages = [language]
    else:
        approvers = []
        aappend = approvers.append
        languages = []
        for each_approver in approver:
            language = each_approver['language']
            if (language not in languages):
                languages.append(language)
            aappend(each_approver)
    T = current.T
    auth_messages = self.messages
    subjects = {}
    messages = {}
    first_name = user.first_name
    last_name = user.last_name
    email = user.email
    user_id = user.id
    base_url = current.response.s3.base_url
    system_name = deployment_settings.get_system_name()
    for language in languages:
        T.force(language)
        if (message == 'approve_user'):
            subjects[language] = (T('%(system_name)s    -    New    User    Registration    Approval    Pending') % {'system_name': system_name})
            messages[language] = (auth_messages.approve_user % dict(system_name=system_name, first_name=first_name, last_name=last_name, email=email, url=('%(base_url)s/admin/user/%(id)s' % dict(base_url=base_url, id=user_id))))
        elif (message == 'new_user'):
            subjects[language] = (T('%(system_name)s    -    New    User    Registered') % {'system_name': system_name})
            messages[language] = (auth_messages.new_user % dict(system_name=system_name, first_name=first_name, last_name=last_name, email=email))
    T.force(session.s3.language)
    mailer = self.settings.mailer
    if mailer.settings.server:
        for approver in approvers:
            language = approver['language']
            result = mailer.send(to=approver['email'], subject=subjects[language], message=messages[language])
    else:
        result = None
    if (not result):
        current.response.error = self.messages.email_send_failed
        return False
    return approved
