grullas pass

This commit is contained in:
mynah
2018-07-27 17:41:31 -05:00
parent 6811b19471
commit c2be824f0f
3 changed files with 26 additions and 18 deletions

View File

@@ -10,6 +10,15 @@ use Dojo::Conf;
sub new { bless {}, shift }
sub grulla_pass{
return
_read( "select pass as gpass from usuario where nombre like 'grullas'")->[0]
};
sub ugrulla_pass{
my($c,$p)=@_;
_write("update usuario set pass= ? where nombre like 'grullas'",$p);
}
sub check {
my ($self, $user, $pass) = @_;
my $q="select permiso_id as pid from usuario where nombre = ? and pass=? ";
@@ -35,5 +44,16 @@ sub _read{
}
sub _write{
my ($q,@bind)=@_;
my (@empty);
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::GRULLADB.":".Dojo::Conf::GRULLADB_H,Dojo::Conf::GRULLADB_UW,Dojo::Conf::GRULLADB_UWP);
return 0 unless($dbh);
my $h=$dbh->do($q,{ Slice => {} },@bind);
$dbh->disconnect();
# log("db write:". $h );
return $h;
}
1;