equal
deleted
inserted
replaced
25 from warnings import warn |
25 from warnings import warn |
26 |
26 |
27 from logilab.common.deprecation import deprecated |
27 from logilab.common.deprecation import deprecated |
28 |
28 |
29 from cubicweb import (NoSelectableObject, ObjectNotFound, ValidationError, |
29 from cubicweb import (NoSelectableObject, ObjectNotFound, ValidationError, |
30 AuthenticationError, typed_eid, UndoTransactionException) |
30 AuthenticationError, typed_eid, UndoTransactionException, |
|
31 Forbidden) |
31 from cubicweb.utils import json_dumps |
32 from cubicweb.utils import json_dumps |
32 from cubicweb.predicates import (authenticated_user, anonymous_user, |
33 from cubicweb.predicates import (authenticated_user, anonymous_user, |
33 match_form_params) |
34 match_form_params) |
34 from cubicweb.web import Redirect, RemoteCallFailed |
35 from cubicweb.web import Redirect, RemoteCallFailed |
35 from cubicweb.web.controller import Controller, append_url_params |
36 from cubicweb.web.controller import Controller, append_url_params |
274 __regid__ = 'reportbug' |
275 __regid__ = 'reportbug' |
275 __select__ = match_form_params('description') |
276 __select__ = match_form_params('description') |
276 |
277 |
277 def publish(self, rset=None): |
278 def publish(self, rset=None): |
278 req = self._cw |
279 req = self._cw |
|
280 desc = req.form['description'] |
|
281 # The description is generated and signed by cubicweb itself, check |
|
282 # description's signature so we don't want to send spam here |
|
283 sign = req.form.get('__signature', '') |
|
284 if not (sign and req.vreg.config.check_text_sign(desc, sign)): |
|
285 raise Forbidden('Invalid content') |
279 self.sendmail(req.vreg.config['submit-mail'], |
286 self.sendmail(req.vreg.config['submit-mail'], |
280 req._('%s error report') % req.vreg.config.appid, |
287 req._('%s error report') % req.vreg.config.appid, |
281 req.form['description']) |
288 desc) |
282 raise Redirect(req.build_url(__message=req._('bug report sent'))) |
289 raise Redirect(req.build_url(__message=req._('bug report sent'))) |
283 |
290 |
284 |
291 |
285 class UndoController(Controller): |
292 class UndoController(Controller): |
286 __regid__ = 'undo' |
293 __regid__ = 'undo' |