summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Snelders <programming@ertai.nl>2012-10-01 23:02:08 +0200
committerRob Snelders <programming@ertai.nl>2012-10-01 23:02:08 +0200
commitabaa1d52d080490ec04e881c1d3636ac2fa440f8 (patch)
treedc7bbeaa481da657c576d699cb8aaa263324ed30
parent633869eb45ed46a1b67c1b559499b55ac1b64d53 (diff)
new bugzilla demands a token. That works now.
-rw-r--r--bug/bug.xhtml1
-rw-r--r--bug/bug/bug.js17
-rw-r--r--bug/bug/test.js7
3 files changed, 25 insertions, 0 deletions
diff --git a/bug/bug.xhtml b/bug/bug.xhtml
index f4c4e05..fe365be 100644
--- a/bug/bug.xhtml
+++ b/bug/bug.xhtml
@@ -181,6 +181,7 @@ Platform (if different from the browser):
<input type="hidden" name="rep_platform" value="Other"></input>
<input type="hidden" name="status_whiteboard" value="BSA"></input>
<input type="hidden" name="assigned_to" value="libreoffice-bugs@lists.freedesktop.org"></input>
+ <input type="hidden" name="token" value=""></input>
<input type="hidden" name="component" value=""></input>
<input type="hidden" name="version" value=""></input>
<input type="hidden" name="short_desc" value=""></input>
diff --git a/bug/bug/bug.js b/bug/bug/bug.js
index a0be19d..9a1ab1e 100644
--- a/bug/bug/bug.js
+++ b/bug/bug/bug.js
@@ -94,6 +94,7 @@
},
url: '',
+ token: '',
state_signin_error_regexps: [/CLASS="THROW_ERROR">([^<]*)/i],
state_signin_success_regexp: /LOG&NBSP;OUT<\/A>([^<]*)/i,
@@ -232,8 +233,23 @@
state_submit_element: 'html',
state_submit: function() {
+ $.bug.logged_in().done(function(status) {
+ if(status) {
+ $.bug.submit_bug();
+ } else {
+ $.bug.error_set("You're not logged in. Please login first");
+ $.bug.state_signin();
+ }
+ });
+ },
+
+ submit_bug: function() {
var element = $('.state_submit');
if(!element.hasClass('initialized')) {
+ $.bug.ajax('GET', $.bug.url + '/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED').pipe(function(data){
+ $.bug.token = data.match(/<input type="hidden" name="token" value="([A-Za-z0-9]{10})">/)[1];
+ });
+
var form = $('.submission_form form');
$.bug.error_clear();
form.attr('action', $.bug.url + '/post_bug.cgi');
@@ -248,6 +264,7 @@
var short_desc = $('.state_subcomponent .active_subcomponent .chosen').attr('data') + ': ' + $('.state_description .short').val();
var comment = $('.state_description .long').val();
$("body").css("cursor", "progress");
+ $('input[name="token"]', form).val($.bug.token);
$('input[name="component"]', form).val(component);
$('input[name="version"]', form).val(version);
$('input[name="short_desc"]', form).val(short_desc);
diff --git a/bug/bug/test.js b/bug/bug/test.js
index defb842..1a36df2 100644
--- a/bug/bug/test.js
+++ b/bug/bug/test.js
@@ -241,6 +241,12 @@ test("state_submit", function() {
equal(element.css('display'), 'none');
ok(!element.hasClass('initialized'), 'is not initialized');
$.bug.state_submit();
+
+ /*$.bug.ajax = function(type, url) {
+ return $.Deferred().resolve('logged in ok');
+ };
+
+ $.bug.state_submit();
equal(element.css('display'), 'block');
ok(element.hasClass('initialized'), 'is initialized');
$.bug.state_component();
@@ -302,6 +308,7 @@ test("state_submit", function() {
equal($('.error').text(), error, 'error is set');
$.bug.state_success = state_success;
+ $.bug.ajax = $.ajax;*/
});
test("state_success", function() {