From 97975886290f65307c0636b3fcb502f4258b1978 Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Tue, 9 Nov 2021 16:01:39 +0100 Subject: fixed width for login form, link form bugfix and + - fixed width of 30 pixels for login form - fix some issue with identifying gpg key in invite-tmpl template - in database, pigeons are now users to avoid confusion --- .gitignore | 2 +- gpigeon-template.cgi | 10 +++++----- gpigeonctl.def.pl | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 3a5c159..8750961 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ gpigeon.cgi gpigeonctl link-tmpl.cgi invites-tmpl.cgi -invites.html +invite.html index.html test/* diff --git a/gpigeon-template.cgi b/gpigeon-template.cgi index 042b78f..c4fb6e9 100755 --- a/gpigeon-template.cgi +++ b/gpigeon-template.cgi @@ -205,11 +205,11 @@ sub PasswdLogin { } } my ($hash, $userid) = undef; - my $selecthash = qq{SELECT pass from pigeons where mail='$username' or name='$username';}; + my $selecthash = qq{SELECT pass from users where mail='$username' or name='$username';}; $hash = DbGetLine($dbh, $selecthash); if (defined $hash and length($hash) > 1){ if(argon2id_verify($hash,$pass)){ - my $selectuserid = qq{SELECT userid from pigeons where pass='$hash';}; + my $selectuserid = qq{SELECT userid from users where pass='$hash';}; $userid = DbGetLine($dbh, $selectuserid); if ($userid =~ /^([0-9]+)$/){ $userid = $1; @@ -372,9 +372,9 @@ print "Cache-Control: no-store, must-revalidate\n"; if($loginok){ $userid = $loginok; - my $user_mailaddr = DbGetLine($dbh, qq{SELECT mail from pigeons where userid='$userid';}); - my $nick = DbGetLine($dbh, qq{SELECT name from pigeons where userid='$userid';}); - my $isadmin = DbGetLine($dbh, qq{SELECT isadmin from pigeons where userid='$userid';}); + my $user_mailaddr = DbGetLine($dbh, qq{SELECT mail from users where userid='$userid';}); + my $nick = DbGetLine($dbh, qq{SELECT name from users where userid='$userid';}); + my $isadmin = DbGetLine($dbh, qq{SELECT isadmin from users where userid='$userid';}); LoginCookieGen($userid, $magic_cookie, $cookiesdir); if ($isadmin){ diff --git a/gpigeonctl.def.pl b/gpigeonctl.def.pl index 86d7295..c41ee11 100755 --- a/gpigeonctl.def.pl +++ b/gpigeonctl.def.pl @@ -209,9 +209,9 @@ if (defined $opt){ RaiseError => 1, AutoCommit => 1, }) or die $DBI::errstr; - $dbh->do('create table pigeons (userid integer primary key, mail text NOT NULL UNIQUE, name text UNIQUE, pass text NOT NULL, gpgfp text NOT NULL UNIQUE, isadmin integer NOT NULL)') or die $DBI::errstr; - $dbh->do('create index idx_pigeonsid on pigeons(userid)') or die $DBI::errstr; - $dbh->do(qq{INSERT INTO pigeons VALUES( ?, '$addr', '$nick', '$hash', '$gpgid', 1)}) or die $DBI::errstr; + $dbh->do('create table users (userid integer primary key, mail text NOT NULL UNIQUE, name text UNIQUE, pass text NOT NULL, gpgfp text NOT NULL UNIQUE, isadmin integer NOT NULL)') or die $DBI::errstr; + $dbh->do('create index idx_usersid on users(userid)') or die $DBI::errstr; + $dbh->do(qq{INSERT INTO users VALUES( ?, '$addr', '$nick', '$hash', '$gpgid', 1)}) or die $DBI::errstr; $dbh->disconnect; unlink 'key.asc'; find(\&recursivechown, $cookiesdir); @@ -237,7 +237,7 @@ if (defined $opt){ AutoCommit => 1, }) or die $DBI::errstr; - $dbh->do(qq{INSERT INTO pigeons VALUES( ?, '$addr', '$nick', '$hash', '$gpgid', 1)}) or die $DBI::errstr; + $dbh->do(qq{INSERT INTO users VALUES( ?, '$addr', '$nick', '$hash', '$gpgid', 1)}) or die $DBI::errstr; $dbh->disconnect; print "\nUser $addr added succesfully\n"; exit 0; @@ -247,8 +247,8 @@ if (defined $opt){ use File::Path qw/rmtree/; my $addr = SetMail(); my $esc = EscapeArobase($addr); - my $uid = DbGetLine($dbh, "SELECT userid FROM pigeons WHERE mail='$esc'") or die "$!"; - $dbh->do(qq{DELETE FROM pigeons where mail='$addr'}) or die $DBI::errstr; + my $uid = DbGetLine($dbh, "SELECT userid FROM users WHERE mail='$esc'") or die "$!"; + $dbh->do(qq{DELETE FROM users where mail='$addr'}) or die $DBI::errstr; $dbh->disconnect; if (defined $uid and $uid > 0){ rmtree("$cookiesdir/$uid", "$web_dir/l/$uid", -- cgit v1.2.3-70-g09d2