1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

Disable sharing repo to unregistered user

This commit is contained in:
xiez
2012-09-27 11:08:05 +08:00
parent bbb091659d
commit e1bb456c0e
2 changed files with 10 additions and 7 deletions

View File

@@ -115,12 +115,15 @@ def share_repo(request):
if not is_registered_user(to_email): if not is_registered_user(to_email):
# Generate shared link and send mail if user has not registered. # Generate shared link and send mail if user has not registered.
kwargs = {'repo_id': repo_id, # kwargs = {'repo_id': repo_id,
'repo_owner': from_email, # 'repo_owner': from_email,
'anon_email': to_email, # 'anon_email': to_email,
'is_encrypted': is_encrypted, # 'is_encrypted': is_encrypted,
} # }
anonymous_share(request, **kwargs) # anonymous_share(request, **kwargs)
msg = u'共享给 %s 失败,用户未注册。' % to_email
messages.add_message(request, messages.ERROR, msg)
continue
else: else:
msg = u'共享给 %s 成功,请前往<a href="%s">共享管理</a>查看。' % \ msg = u'共享给 %s 成功,请前往<a href="%s">共享管理</a>查看。' % \
(to_email, reverse('share_admin')) (to_email, reverse('share_admin'))

View File

@@ -53,7 +53,7 @@
{% include "snippets/shared_in_repos.html" %} {% include "snippets/shared_in_repos.html" %}
{% url 'share_repo' as repo_share_url %} {% url 'share_repo' as repo_share_url %}
{% with post_url=repo_share_url tips='可以是非网站注册用户,我们会以邮件通知对方。' %} {% with post_url=repo_share_url tips='' %}
{% include "snippets/repo_share_form.html" %} {% include "snippets/repo_share_form.html" %}
{% endwith %} {% endwith %}