diff --git a/requirements.txt b/requirements.txt index e875b4bfdf..900b91de74 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,3 +20,4 @@ gunicorn==19.8.1 django-webpack-loader==0.6.0 git+git://github.com/haiwen/python-cas.git@ffc49235fd7cc32c4fdda5acfa3707e1405881df#egg=python_cas futures==3.2.0 +social-auth-core==1.7.0 diff --git a/seahub/notifications/management/commands/send_wxwork_notices.py b/seahub/notifications/management/commands/send_wxwork_notices.py new file mode 100644 index 0000000000..c6e6125086 --- /dev/null +++ b/seahub/notifications/management/commands/send_wxwork_notices.py @@ -0,0 +1,164 @@ +# Copyright (c) 2012-2016 Seafile Ltd. +# encoding: utf-8 +from datetime import datetime +import logging +import re + +from django.conf import settings +from django.core.management.base import BaseCommand +from django.core.urlresolvers import reverse +from django.utils import translation +from django.utils.translation import ungettext +from social_django.models import UserSocialAuth +from weworkapi import CorpApi + +from seahub.base.models import CommandsLastCheck +from seahub.notifications.models import UserNotification +from seahub.profile.models import Profile +from seahub.utils import get_site_scheme_and_netloc, get_site_name + +# Get an instance of a logger +logger = logging.getLogger(__name__) + +########## Utility Functions ########## +def wrap_div(s): + """ + Replace xx to xx and wrap content with
. + """ + patt = '
{% trans "Social Login" %}
+ ++ +-
+ {% if request.LANGUAGE_CODE == 'zh-cn' %}
+ 企业微信
+ {% else %}
+ WeChat Work
+ {% endif %}
+
+ {% if social_connected %}
+ {% trans "Disconnect" %}
+ {% else %}
+ {% trans "Connect" %}
+ {% endif %}
+
+
+
+ +