summaryrefslogtreecommitdiffstats
path: root/mdkapplet-add-media-helper
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-13 18:51:28 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-13 18:51:28 +0000
commit6cfd95a49b0c0df8b334f43b3e6e3df9d1806778 (patch)
treeb4604dd13c7c76281c0a17b580b78687be26419b /mdkapplet-add-media-helper
parentd1d202c7a9a264f4025c60d993f383c7a0ebbe89 (diff)
downloadmgaonline-6cfd95a49b0c0df8b334f43b3e6e3df9d1806778.tar
mgaonline-6cfd95a49b0c0df8b334f43b3e6e3df9d1806778.tar.gz
mgaonline-6cfd95a49b0c0df8b334f43b3e6e3df9d1806778.tar.bz2
mgaonline-6cfd95a49b0c0df8b334f43b3e6e3df9d1806778.tar.xz
mgaonline-6cfd95a49b0c0df8b334f43b3e6e3df9d1806778.zip
* mdkonline.pm (get_my_mdv_profile): Moved from authenticate_callback
for reusability. * mdkapplet-add-media-helper (authenticate_callback): renamed for readability.
Diffstat (limited to 'mdkapplet-add-media-helper')
-rwxr-xr-xmdkapplet-add-media-helper18
1 files changed, 7 insertions, 11 deletions
diff --git a/mdkapplet-add-media-helper b/mdkapplet-add-media-helper
index e0b04847..af710799 100755
--- a/mdkapplet-add-media-helper
+++ b/mdkapplet-add-media-helper
@@ -127,7 +127,7 @@ sub run_authentication_dialog {
"additional package medium");
mdkapplet_gui::run_ask_credentials_dialog($title,
$description,
- \&add_restricted_medium);
+ \&authenticate_callback);
ugtk2::exit(0);
}
@@ -155,22 +155,18 @@ sub run_no_rights_dialog() {
mdkapplet_gui::fill_n_run_portable_dialog($w, \@widgets);
}
-sub add_restricted_medium {
+sub authenticate_callback {
my ($email, $passwd) = @_;
my $product = $product{$up_product};
- my $my_profile = mdkonline::xml2perl(
- mdkonline::get_from("https://my.mandriva.com/rest/authenticate",
- [ 'username', $email,
- 'password', $passwd,
- 'return', 'userdata' ]
- ));
- if ($my_profile->{code} != 0) {
+ my $profile = mdkonline::get_my_mdv_profile();
+
+ if ($profile->{code} != 0) {
my $in = interactive->vnew;
$in->ask_warn(N("Error"),
- N("An error occurred") . "\n" . $my_profile->{message});
+ N("An error occurred") . "\n" . $profile->{message});
goto &run_authentication_dialog;
}
- elsif (!$product->{has_rights}->($my_profile)) {
+ elsif (!$product->{has_rights}->($profile)) {
run_no_rights_dialog();
}
else {