Commit e1b5247d authored by Remi Oudin's avatar Remi Oudin Committed by Charlie Jacomme

[Cablâge] Possibilité de supprimer la redirection

parent 3f41443a
......@@ -149,6 +149,7 @@
</div>
<div class="four columns">
<a class="button" href="{% url 'compte:redirection' luser.aid.0 %}">Changer la redirection mail</a>
<a class="button-del" href="{% url 'compte:delete_forward' luser.aid.0 %}">Supprimer la redirection mail.</a>
</div>
{% else %}
{% if cablage %}
......
......@@ -17,6 +17,7 @@ urlpatterns = patterns('',
url('^redirection/$', views.redirection, name='redirection'),
url('^redirection/(?P<uid>[0-9]+)/$', views.redirection, name='redirection'),
url('^redirection/(?P<uid>[0-9]+)/(?P<generate>True)/(?P<next>.*)/$', views.redirection, name='redirection'),
url('^delete_forward/(?P<uid>[0-9]+)/$', views.deleteforward, name='delete_forward'),
url('^alias/$', views.alias, name='alias'),
url('^alias/(?P<ptype>club)/(?P<uid>[0-9]+)/$', views.alias, name='alias'),
url('^alias/(?P<ptype>adh)/(?P<uid>[0-9]+)/$', views.alias, name='alias'),
......
......@@ -255,7 +255,20 @@ class RedirectionView(CableurOrSelfMixin, RedirectHomeMixin, View):
redirection = RedirectionView.as_view()
class DeleteForwardView(CableurOrSelfMixin, RedirectHomeMixin, View):
"""
Classe pour la suppresion d'une redirection mail.
"""
def get(self,request,uid,next="/compte/",*args,**kwargs):
luser = conn_pool.get_conn(request.user).search(u'aid=%s' % uid, mode='w')[0]
try:
redirection_mail = subprocess.Popen(["sudo","-n","/usr/scripts/utils/forward.py", "--delete", "--name=%s" %luser['uid'][0]])
messages.success(request,u"""Votre redirection a été supprimée, pensez à consulter régulièrement votre adresse Cr@ns!""")
except ValueError as e:
messages.error(request,e)
return redirect(next)
deleteforward = DeleteForwardView.as_view()
class DeleteAliasView(CableurMixin, RedirectHomeMixin, View):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment