View | Details | Raw Unified | Return to bug 6473
Collapse All | Expand All

(-)a/lib/GitBz/Commands.pm (-2 / +14 lines)
Lines 41-48 sub new { Link Here
41
    );
41
    );
42
42
43
    # Auto-login if credentials available
43
    # Auto-login if credentials available
44
    if ( $ENV{BUGZILLA_USER} && $ENV{BUGZILLA_PASSWORD} ) {
44
    my $username = $ENV{BUGZILLA_USER};
45
        $client->login( $ENV{BUGZILLA_USER}, $ENV{BUGZILLA_PASSWORD} );
45
    my $password = $ENV{BUGZILLA_PASSWORD};
46
47
    # Try git config if env vars not set
48
    if ( !$username || !$password ) {
49
        my $tracker_section = qq{bz-tracker "$tracker"};
50
        my $tracker_config  = $config->{config}->{$tracker_section};
51
52
        $username ||= $tracker_config->{'bz-user'}     if $tracker_config;
53
        $password ||= $tracker_config->{'bz-password'} if $tracker_config;
54
    }
55
56
    if ( $username && $password ) {
57
        $client->login( $username, $password );
46
    }
58
    }
47
59
48
    return bless {
60
    return bless {
(-)a/lib/GitBz/Config.pm (-9 / +1 lines)
Lines 27-40 my $DEFAULT_CONFIG = { Link Here
27
        'default-product'  => 'Koha',
27
        'default-product'  => 'Koha',
28
        path               => '/bugzilla3',
28
        path               => '/bugzilla3',
29
    },
29
    },
30
    'bugzilla.gnome.org' => {
31
        https              => 1,
32
        'default-priority' => 'Normal',
33
    },
34
    'bugs.freedesktop.org' => {
35
        https              => 1,
36
        'default-priority' => 'medium',
37
    },
38
};
30
};
39
31
40
my $GIT_CONFIG = {
32
my $GIT_CONFIG = {
Lines 46-52 my $GIT_CONFIG = { Link Here
46
sub load {
38
sub load {
47
    my ($class) = @_;
39
    my ($class) = @_;
48
40
49
    my $config_file = File::HomeDir->my_home . '/.gitbzrc';
41
    my $config_file = File::HomeDir->my_home . '/.gitconfig';
50
    my $config      = -f $config_file ? Config::Tiny->read($config_file) : {};
42
    my $config      = -f $config_file ? Config::Tiny->read($config_file) : {};
51
43
52
    # Load git config
44
    # Load git config
(-)a/lib/GitBz/RestClient.pm (-9 / +5 lines)
Lines 46-59 sub new { Link Here
46
sub login {
46
sub login {
47
    my ( $self, $username, $password ) = @_;
47
    my ( $self, $username, $password ) = @_;
48
48
49
    my $response = $self->{ua}->post(
49
    my $response = $self->{ua}->get(
50
        $self->{base_url} . '/login',
50
        sprintf(
51
        Content_Type => 'application/json',
51
            "%s/login?login=%s&password=%s",
52
        Content      => encode_json(
52
            $self->{base_url}, $username,
53
            {
53
            $password
54
                login    => $username,
55
                password => $password
56
            }
57
        )
54
        )
58
    );
55
    );
59
56
60
- 

Return to bug 6473