Skip Menu |

This queue is for tickets about the WWW-Bugzilla CPAN distribution.

Report information
The Basics
Id: 19819
Status: open
Worked: 5 min
Priority: 0/
Queue: WWW-Bugzilla

People
Owner: bmc [...] shmoo.com
Requestors: jpo [...] di.uminho.pt
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.6
Fixed in: (no value)



Subject: Can not login in Red Hat bugzilla
Server: bugzilla.redhat.com/bugzilla Trying to login in Red Hat bugzilla system fails with the following messgae: "No such field 'Bugzilla_login' at /usr/lib/perl5/vendor_perl/5.8.8/WWW/Mechanize.pm line 1052". Apparently the login form is not the first one in the page but the second (see mech-dump output below). When I changed the _login method to use the second form instead of the first I was able to login: - $mech->form_number(1); + $mech->form_number(2); Mech-dump output $ mech-dump https://bugzilla.redhat.com/bugzilla/query.cgi?GoAheadAndLogIn=1 -------------------- GET https://bugzilla.redhat.com/bugzilla/show_bug.cgi id= (text) <NONAME>=Go (submit) POST https://bugzilla.redhat.com/bugzilla/query.cgi Bugzilla_login= (text) Bugzilla_password= (password) GoAheadAndLogIn=1 (hidden readonly) GoAheadAndLogIn=Login (submit) GET https://bugzilla.redhat.com/bugzilla/token.cgi a=reqpw (hidden readonly) loginname= (text) <NONAME>=Submit Request (submit) -------------------- Would it be possible to specify the bugzilla login form in the module constructor? Maybe a named variable loginform or even a named variable profile (possible standard, redhat, ...) with custom configurations? TIA, jpo
From: jpo [...] di.uminho.pt
Brian, Another alternative could be something like: -------------------- sub __get_login_form { my $mech = shift; my $loginform = 1; # Default login form my @forms = $mech->forms(); for (my $i = 1; $i <= scalar(@forms); $i++ ) { if ( $forms[$i - 1]->find_input('Bugzilla_login') ) { $loginform = $i; last; } } return $loginform; } sub _login { ... $mech->form_number( __get_login_form($mech) ); $mech->field('Bugzilla_login', $email); $mech->field('Bugzilla_password', $password); $mech->submit_form(); ... } -------------------- jpo
From: jpo [...] di.uminho.pt
Brian, Any changes of having this problem resolved in a new release of WWW::Bugzilla? I am asking this because I'm a packager for the Fedora Extras project and I would like to add this package to the project but as we use the Red Hat bugzilla infra-structure to review and keep track of bugs, I would have to submit this module patched in order to have it working for us (and I would like to avoid that). Thanks in advance, jpo
This should be fixed in 0.8, which I hope to release later today.
On Mon Jun 19 08:48:48 2006, BMC wrote: Show quoted text
> This should be fixed in 0.8, which I hope to release later today.
Using a similar idea, but modifing the mech state directly, as well as making the field that I am looking for an input variable, as I'm willing to bet that other forms are going to have the same issue. In case you can't wait: sub _get_form_by_field { my ($self, $field) = @_; croak("invalid field") if !$field; my $mech = $self->{mech}; my $i = 1; foreach my $form ($mech->forms()) { if ($form->find_input($field)) { $mech->form($i); return; } $i++; } croak("No form with the field $field available"); } Then use: $self->_get_form_by_field('Bugzilla_login');
From: jpo [...] di.uminho.pt
On Mon Jun 19 09:55:53 2006, BMC wrote: Show quoted text
> On Mon Jun 19 08:48:48 2006, BMC wrote:
> > This should be fixed in 0.8, which I hope to release later today.
I'm now able to login in Red Hat's bugzilla! Thanks Brian.
From: jpo [...] di.uminho.pt
Brian, Just a small remimder: don't forget to update the Changes file (there are no log entries for the releases 0.7 and 0.8). jpo PS - I'm a packager. I can't help noticing these small details ;)