'This corrects any passwords that have drifted from eamap to
internal django auth.  Needs to be removed when fixed in external_auth'

def fix_external_auth_map_passwords(self):

    msg = ''
    for eamap in ExternalAuthMap.objects.all():
        euser = eamap.user
        epass = eamap.internal_password
        if (euser is None):
            continue
        try:
            testuser = authenticate(username=euser.username, password=epass)
        except (TypeError, PermissionDenied, AttributeError) as err:
            msg += _('Failed    in    authenticating    {username},    error    {error}\n').format(username=euser, error=err)
            continue
        if (testuser is None):
            msg += _('Failed    in    authenticating    {username}\n').format(username=euser)
            msg += _('fixed    password')
            euser.set_password(epass)
            euser.save()
            continue
    if (not msg):
        msg = _('All    ok!')
    return msg
