diff options
author | Miquel Lionel <lionel@les-miquelots.net> | 2021-11-09 16:01:39 +0100 |
---|---|---|
committer | Miquel Lionel <lionelmiquel@sfr.fr> | 2021-11-09 16:18:43 +0100 |
commit | 97975886290f65307c0636b3fcb502f4258b1978 (patch) | |
tree | 2478407be053e44681c0df927e691046f3bef492 | |
parent | 52fb6ab96259df5eb63ae4632317edcf5900f31c (diff) | |
download | gpigeon-97975886290f65307c0636b3fcb502f4258b1978.tar.gz gpigeon-97975886290f65307c0636b3fcb502f4258b1978.zip |
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
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | gpigeon-template.cgi | 10 | ||||
-rwxr-xr-x | gpigeonctl.def.pl | 12 |
3 files changed, 12 insertions, 12 deletions
@@ -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", |