summaryrefslogtreecommitdiffstats
path: root/inwx-add-record.pl
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-04-22 22:24:24 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-04-22 22:24:24 +0200
commit2a5f8639fcc21add3f9161d4986542005d4b1833 (patch)
tree16e9f0e4d64bfd1c2f0f8bb4008d0949497af968 /inwx-add-record.pl
parent31da047b3c06927bd80b78071119678004371098 (diff)
downloadbin-2a5f8639fcc21add3f9161d4986542005d4b1833.tar.gz
bin-2a5f8639fcc21add3f9161d4986542005d4b1833.tar.xz
misc
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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 {