summaryrefslogtreecommitdiffstats
path: root/inwx-add-record.pl
diff options
context:
space:
mode:
Diffstat (limited to 'inwx-add-record.pl')
-rwxr-xr-xinwx-add-record.pl17
1 files changed, 12 insertions, 5 deletions
diff --git a/inwx-add-record.pl b/inwx-add-record.pl
index 135c0b7..c4bcf2d 100755
--- a/inwx-add-record.pl
+++ b/inwx-add-record.pl
@@ -9,6 +9,7 @@ use File::Basename;
use HTTP::Cookies;
use Try::Tiny;
use XMLRPC::Lite; # +trace => 'all';
+use JSON;
# FIXME: put this in a config file
@@ -27,10 +28,16 @@ my $name = shift @ARGV;
my $type = shift @ARGV;
my $content = shift @ARGV;
-my $client = DomRobot->proxy($addr, cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
-$client->call('account.login', { user => $usr, pass => $pwd });
-my $TFAToken = getInput("Enter 2FA token (press enter if 2FA is not used)");
-$client->call('account.unlock', { tan => $TFAToken }) if $TFAToken ne '';
+my $client = DomRobot->proxy($addr, cookie_jar => HTTP::Cookies->new(file => "$ENV{HOME}/.inwx-add-record.cookies", autosave => 1, ignore_discard => 1));
+
+sub login {
+ $client->call('account.login', { user => $usr, pass => $pwd });
+ my $TFAToken = getInput("Enter 2FA token (press enter if 2FA is not used)");
+ $TFAToken =~ s/ //g;
+ $client->call('account.unlock', { tan => $TFAToken }) if $TFAToken ne '';
+}
+
+#login();
#open(my $fh, '<', 'domains') or die "Failed to open: $!";
@@ -46,7 +53,7 @@ $client->call('account.unlock', { tan => $TFAToken }) if $TFAToken ne '';
#}
#close $fh;
-$client->logout;
+#$client->logout;
exit 0;
sub getInput {