Apache-DnsZone

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN

  PerlSetVar   DnsZoneDBuser              'dnszone'
  PerlSetVar   DnsZoneDBpass              '*******'
  PerlSetVar   DnsZoneDebugLevel          1
  PerlSetVar   DnsZoneLangDir             '/usr/local/modperl/dnszone'
  PerlSetVar   DnsZoneTemplateDir         '/usr/local/modperl/dnszone/template'
  PerlSetVar   DnsZoneLoginLang           'en'
  # or 'de' 'se' 'dk' 'fr' 'it' 
  # DnsZoneLoginLang is used if the browser doesn't send an 'Accept-Language' header and the language isn't in DnsZone already
  PerlModule   Apache::DnsZone::AuthCookie
  PerlSetVar   DnsZoneTicketTable         'tickets:ticket_hash:ts'
  PerlSetVar   DnsZoneTicketUserTable     'users:username:password'
  PerlSetVar   DnsZoneTicketPasswordStyle cleartext
  PerlSetVar   DnsZoneTicketSecretTable   'ticketsecrets:sec_data:sec_version'
  PerlSetVar   DnsZoneTicketExpires       60
  PerlSetVar   DnsZoneTicketLogoutURI     /
  PerlSetVar   DnsZoneTicketLoginHandler  /login
  PerlSetVar   DnsZoneTicketIdleTimeout   10
  PerlSetVar   DnsZonePath                /
  PerlSetVar   DnsZoneLoginScript         /loginform
  <Location /admin>
    SetHandler        perl-script

SECURITY  view on Meta::CPAN

Since security related to Dynamic updates in Bind is currently only 
IP-related and not username and password there are a few things to look
out for.

Every user on the system will have access to update the zones managed 
with DnsZone, so you need to either trust these users enough or simply 
use a machine only to run DnsZone on.

IP-spoofing:
Should not be a problem, since routers should take care of removing 
packets that are trying to be spoofed as coming from the local network. 
IP spoofing from the local lan could be a possibility but generally you

TODO  view on Meta::CPAN

[Fixed]   *.domain IN A <ip> 
[Fixed]   *.domain IN TXT <txt>
[Fixed]   *.domain IN MX <number> <mailhost>
[Fixed]   # works round robin style and together
[Fixed]   *.domain not provided for CNAME (doesn't work with any other *. record)(could be offered if we bother to check for other * records before + before adding other * records)
[Fixed]   *.domain not provided for NS (seems obvious not to use this)
[Fixed] Functions that use sql should be moved to Apache::DnsZone::DB::<db>
[Fixed] Can a preference be 0? (check_preference)
[Fixed] Allow more chars in check_txt?
[Fixed] Move around sql queries! so it might not be in the main file
[Fixed] functions to be implemented: (uid,email,lang_id,lang)get_user_info(username)(OK) (count)dom_count(uid)(OK) (lang_select)lang_select(uid, evt override lang_id)(OK) (1)update_password(uid, password)(OK) (domain, domain_owner_id)domain_stat?(dom...
[Fixed] all the (a|cname|mx|ns|txt)_lookup's have been made - why isn't the program using them? (MESSY!!!)
[Fixed] functions for the count(id)'s in mysql.pm?
[Fixed] list_domains need a way to prepare and get an executed statement handle back so the sql goes out of the function - along with view_domains
[Fixed] check_before*: return 1 if old eq new????? something is wrong with check_before_edit_MX|NS|TXT|A|CNAME
[Fixed] conflicts checking, rules:
[Fixed]   A, NS, MX, TXT can reside together.
[Fixed]   CNAME records can't have anything else associated with the same "name" not, A, NS, TXT, MX
[Fixed]   no .. in hostnames (checked for in check_host(fq-host))
[Fixed] already exsisting names? that need to be checked OFTEN! (maybe in check_*)
[Fixed] better checking on hosts (check_host|fqdn obviously doesn't work at all when you do anything that has an error in it)

TODO  view on Meta::CPAN

[Fixed] AAAA support using Net::IP for expanding addresses (including bin/ for AAAA)

For 1.0 to be released (So far):

[Medium] Use of uninitialized value (SOA)
[Medium] remove references to /admin and to specific action=blah stuff? $SUBMIT_URL in all templates?
[Medium] use of uninitialized value in DnsZone.pm (maybe be turned of with PerlWarn off

Documentation/Configuration page on website

Forgotten password feature?

Admintools (change password,)

Crypted passwords in the database (tools need to use this)

ENUM instead of int(1) in mysql? (too much work)

code audit

clearer documentation

PTR bin/ support! addreverse.pl

RP records

bin/mysql/adduser.pl  view on Meta::CPAN

print "Username to add: ";
my $user = <>;
chomp($user);
if ($dbh->selectrow_array("select id from users where username = ?", undef, $user)) {
    print "$user name already in use\n";
    $dbh->disconnect();
    exit 1;
}
print "Password for $user: ";
ReadMode('noecho');
my $password = ReadLine(0);
chomp($password);
print "\nPassword again: ";
my $password_confirm = ReadLine(0);
chomp($password_confirm);
ReadMode(0);
unless ($password eq $password_confirm) {
    print "\nTwo wrongs doesn't make a right!\n";
    $dbh->disconnect();
    exit 1;
}
print "\n";

print "Users email: ";
my $email = <>;
chomp($email);
unless ($email = Email::Valid->address($email)) {

bin/mysql/adduser.pl  view on Meta::CPAN

my $lang = "";

do {
    print "Language: ";
    $lang = <>;
    chomp($lang);
} while ($lang ne $dbh->selectrow_array("select lang from languages where lang = ?", undef, $lang));

my $lang_id = $dbh->selectrow_array("select id from languages where lang = ?", undef, $lang);

$dbh->do("insert into users (id, username, password, email, lang) values ('',?,?,?,?)", undef, $user, $password, $email, $lang_id);

print "$user($email:$lang) added...\n";

$dbh->disconnect();

bin/oracle/adduser.pl  view on Meta::CPAN

my $user = <>;
chomp($user);
if ($dbh->selectrow_array("select id from users where username = ?", undef, $user)) {
    print "$user name already in use\n";
    $dbh->rollback();
    $dbh->disconnect();
    exit 1;
}
print "Password for $user: ";
ReadMode('noecho');
my $password = ReadLine(0);
chomp($password);
print "\nPassword again: ";
my $password_confirm = ReadLine(0);
chomp($password_confirm);
ReadMode(0);
unless ($password eq $password_confirm) {
    print "\nTwo wrongs doesn't make a right!\n";
    $dbh->rollback();
    $dbh->disconnect();
    exit 1;
}
print "\n";

print "Users email: ";
my $email = <>;
chomp($email);

bin/oracle/adduser.pl  view on Meta::CPAN

my $lang = "";

do {
    print "Language: ";
    $lang = <>;
    chomp($lang);
} while ($lang ne $dbh->selectrow_array("select lang from languages where lang = ?", undef, $lang));

my $lang_id = $dbh->selectrow_array("select id from languages where lang = ?", undef, $lang);

$dbh->do("insert into users (id, username, password, email, lang) values (users_id.nextval,?,?,?,?)", undef, $user, $password, $email, $lang_id);

$dbh->commit();
print "$user($email:$lang) added...\n";

$dbh->disconnect();



bin/postgresql/adduser.pl  view on Meta::CPAN

my $user = <>;
chomp($user);
if ($dbh->selectrow_array("select id from users where username = ?", undef, $user)) {
    print "$user name already in use\n";
    $dbh->rollback();
    $dbh->disconnect();
    exit 1;
}
print "Password for $user: ";
ReadMode('noecho');
my $password = ReadLine(0);
chomp($password);
print "\nPassword again: ";
my $password_confirm = ReadLine(0);
chomp($password_confirm);
ReadMode(0);
unless ($password eq $password_confirm) {
    print "\nTwo wrongs doesn't make a right!\n";
    $dbh->rollback();
    $dbh->disconnect();
    exit 1;
}
print "\n";

print "Users email: ";
my $email = <>;
chomp($email);

bin/postgresql/adduser.pl  view on Meta::CPAN

my $lang = "";

do {
    print "Language: ";
    $lang = <>;
    chomp($lang);
} while ($lang ne $dbh->selectrow_array("select lang from languages where lang = ?", undef, $lang));

my $lang_id = $dbh->selectrow_array("select id from languages where lang = ?", undef, $lang);

$dbh->do("insert into users (id, username, password, email, lang) values ('',?,?,?,?)", undef, $user, $password, $email, $lang_id);

$dbh->commit();
print "$user($email:$lang) added...\n";

$dbh->disconnect();

conf/dnszone.conf  view on Meta::CPAN

  PerlSetVar   DnsZoneDBsrc               'dbi:mysql:dnszone'
  PerlSetVar   DnsZoneDBuser              'dnszone'
  PerlSetVar   DnsZoneDBpass              '*******'
  PerlSetVar   DnsZoneDebugLevel          1
  PerlSetVar   DnsZoneLangDir             '/usr/local/modperl/dnszone'
  PerlSetVar   DnsZoneTemplateDir         '/usr/local/modperl/dnszone/template'
  PerlSetVar   DnsZoneLoginLang           'en'
  PerlSetVar   DnsZoneLogoutHandler       /logout
  PerlModule   Apache::DnsZone::AuthCookie
  PerlSetVar   DnsZoneTicketTable         'tickets:ticket_hash:ts'
  PerlSetVar   DnsZoneTicketUserTable     'users:username:password'
  PerlSetVar   DnsZoneTicketPasswordStyle cleartext
  PerlSetVar   DnsZoneTicketSecretTable   'ticketsecrets:sec_data:sec_version'
  PerlSetVar   DnsZoneTicketExpires       60
  PerlSetVar   DnsZoneTicketLogoutURI     /
  PerlSetVar   DnsZoneTicketLoginHandler  /login
  PerlSetVar   DnsZoneTicketIdleTimeout   10
  PerlSetVar   DnsZonePath                /
  PerlSetVar   DnsZoneLoginScript         /loginform
  <Location /admin>
    SetHandler        perl-script

lang/dk.lang  view on Meta::CPAN

		'ERROR_HOST'        => 'Ukorrekt v&aelig;rdi for V&aelig;rt',
		'ERROR_REVERSE'     => 'Ukorrekt v&aelig;rdi for Omvendt opslag',
		'ERROR_TTL'         => 'Ukorrekt v&aelig;rdi for Levetid',
		'ERROR_CNAME'       => 'Ukorrekt v&aelig;rdi for Kanonisk navn',
		'ERROR_MX'          => 'Ukorrekt v&aelig;rdi for Mail udveksler',
		'ERROR_PREFERENCE'  => 'Ukorrekt v&aelig;rdi for Pr&aelig;ference',
		'ERROR_ZONE'        => 'Ukorrekt v&aelig;rdi for Zone',
		'ERROR_NS'          => 'Ukorrekt v&aelig;rdi for Navneeserver',
		'ERROR_TXT'         => 'Ukorrekt v&aelig;rdi for Tekst data',
		'ERROR_EMAIL'       => 'Ukorrekt v&aelig;rdi for E-mail',
		'ERROR_PASSWORD'    => 'Non-matching passwords',
		'ERROR_ADMIN_EMAIL' => 'Ukorrekt v&aelig;rdi for Administrativ e-mail',
		'ERROR_REFRESH'     => 'Ukorrekt v&aelig;rdi for Genopfrisknings interval',
		'ERROR_RETRY'       => 'Ukorrekt v&aelig;rdi for Gentagelses interval',
		'ERROR_EXPIRE'      => 'Ukorrekt v&aelig;rdi for Udl&oslash;bs interval',
		'FILLOUT_FIELDS'    => 'Udfyld venligst f&oslash;lgende felter:',
		'EDIT_FIELDS'       => 'Ret felter:',
		'DELETE_RECORD'     => 'Du er ved slette f&oslash;lgende post:',
		'USERNAME'          => 'Brugernavn',
		'PASSWORD'          => 'Kodeord',
		'LOGIN_BUTTON'      => 'Log p&aring;',

lang/en.lang  view on Meta::CPAN

		'HELP'              => 'Help',
		'EDIT'              => 'Edit',
		'ADD'               => 'Add',
		'REMOVE'            => 'Remove',
		'LOCKED'            => 'Locked',
		'SETTINGS'          => 'Settings',
		'LIST_DOMAIN'       => 'Domainlist',
		'LOGOUT'            => 'Logout',
		'LANGUAGE'          => 'Language',
		'EMAIL'             => 'E-mail',
		'NEW_PASSWORD'      => 'New password',
		'CONFIRM_PASSWORD'  => 'Confirm password',
		'AUTH_NS'           => 'Authoritative nameserver',
		'SERIAL'            => 'Serial number',
		'ADMIN_EMAIL'       => 'Administrative e-mail',
		'REFRESH'           => 'Refresh time',
		'RETRY'             => 'Retry time',
		'EXPIRE'            => 'Expire time',
		'TTL'               => 'Time to Live',
		'HOST'              => 'Host',
		'REVERSE_HOST'      => 'Reverse Host',
		'IP_ADDRESS'        => 'IP address',

lang/en.lang  view on Meta::CPAN

		'ERROR_HOST'        => 'Incorrect value for Host',
		'ERROR_REVERSE'     => 'Incorrect value for Reverse Host',
		'ERROR_TTL'         => 'Incorrect value for TTL',
		'ERROR_CNAME'       => 'Incorrect value for Canonical Name',
		'ERROR_MX'          => 'Incorrect value for Mail exchanger',
		'ERROR_PREFERENCE'  => 'Incorrect value for Preference',
		'ERROR_ZONE'        => 'Incorrect value for Zone',
		'ERROR_NS'          => 'Incorrect value for Nameserver',
		'ERROR_TXT'         => 'Incorrect value for Text',
		'ERROR_EMAIL'       => 'Incorrect value for E-mail',
		'ERROR_PASSWORD'    => 'Non-matching passwords',
		'ERROR_ADMIN_EMAIL' => 'Incorrect value for Administrative e-mail',
		'ERROR_REFRESH'     => 'Incorrect value for Refresh time',
		'ERROR_RETRY'       => 'Incorrect value for Retry time',
		'ERROR_EXPIRE'      => 'Incorrect value for Expire time',
		'FILLOUT_FIELDS'    => 'Please fill out the following fields:',
		'EDIT_FIELDS'       => 'Please edit fields:',
		'DELETE_RECORD'     => 'You are about to delete the following record:',
		'USERNAME'          => 'Username',
		'PASSWORD'          => 'Password',
		'LOGIN_BUTTON'      => 'Log In',

lang/it.lang  view on Meta::CPAN

		'HELP'              => 'Aiuto', 
		'EDIT'              => 'Modifica', 
		'ADD'               => 'Aggiungi', 
		'REMOVE'            => 'Elimina', 
		'LOCKED'            => 'Bloccato', 
		'SETTINGS'          => 'Preferenze', 
		'LIST_DOMAIN'       => 'Lista dei domini',
		'LOGOUT'            => 'Logout',
		'LANGUAGE'          => 'Lingua', 
		'EMAIL'             => 'E-mail',
		'NEW_PASSWORD'      => 'Nuova password', 
		'CONFIRM_PASSWORD'  => 'Conferma password', 
		'AUTH_NS'           => 'Nameserver Autoritativo', 
		'SERIAL'            => 'Numero Seriale', 
		'ADMIN_EMAIL'       => 'E-mail Amministrativa', 
		'REFRESH'           => 'Refresh', 
		'RETRY'             => 'Retry', 
		'EXPIRE'            => 'Expire', 
		'TTL'               => 'TTL', 
		'HOST'              => 'Host',
		'REVERSE_HOST'      => 'Reverse Host',
		'IP_ADDRESS'        => 'Indirizzo IP',

lang/it.lang  view on Meta::CPAN

		'ERROR_HOST'        => 'Valore non corretto per l\'Host',
		'ERROR_REVERSE'     => 'Valore non corretto per il Reverse Host',
		'ERROR_TTL'         => 'Valore non corretto per il campo TTL',
		'ERROR_CNAME'       => 'Valore non corretto per il campo CNAME',
		'ERROR_MX'          => 'Valore non corretto per il campo MX',
		'ERROR_PREFERENCE'  => 'Valore non corretto per la priotit&agrave; MX',
		'ERROR_ZONE'        => 'Valore non corretto per la zona',
		'ERROR_NS'          => 'Valore non corretto per il nameserver',
		'ERROR_TXT'         => 'Valore non corretto per il campo TXT',
		'ERROR_EMAIL'       => 'Valore non corretto per l\'E-mail',
		'ERROR_PASSWORD'    => 'Le password non sono uguali',
		'ERROR_ADMIN_EMAIL' => 'Valore non corretto per l\'E-mail Amministrativa',
		'ERROR_REFRESH'     => 'Valore non corretto per il Refresh time',
		'ERROR_RETRY'       => 'Valore non corretto per il Retry time',
		'ERROR_EXPIRE'      => 'Valore non corretto per l\'Expire time',
		'FILLOUT_FIELDS'    => 'Per favore riempire i seguenti campi:',
		'EDIT_FIELDS'       => 'Per favore modificare i campi:',
		'DELETE_RECORD'     => 'Il seguente record sta per essere cancellato:',
		'USERNAME'          => 'Nome Utente',
		'PASSWORD'          => 'Password',
		'LOGIN_BUTTON'      => 'Login',
		'PAGE_LOGIN'        => 'Pagina di Login',
		'LOGIN_NOTE'        => 'Nota: Per poter effettuare il login occorre impostare il browser per accettare i cookie. Dopo un certo periodo di tempo ti verr&agrave; richiesto di rieseguire il login.',
		'IDLE_TIMEOUT'      => 'Motivo del Logout: Timeout della connessione',
		'MALFORMED_TICKET'  => 'Motivo del Logout: Sessione errata',
		'INVALID_HASH'      => 'Motivo del Logout: Sessione sconosciuta',
		'EXPIRED_TICKET'    => 'Motivo del Logout: Sessione scaduta',
		'MISSING_SECRET'    => 'Motivo del Logout: Errore del server',
		'TAMPERED_HASH'     => 'Motivo del Logout: Sessione modificata illecitamente',
		'PASSWORD_CHANGE'   => 'La password verr&agrave; cambiata solo se verr&agrave; scritto qualcosa nel campo sottostante.'
		); 

    return %text; 
} 

1; 




lib/Apache/DnsZone.pm  view on Meta::CPAN


	my $all_set = 1;
	my $user_email = apr()->param('user_email');
	if (!($user_email = check_email($user_email))) {
	    $all_set = 0;
	}
	my $lang_id = apr()->param('lang');
	if (!check_lang($lang_id)) {
	    $all_set = 0;
	}
        if (apr()->param('password') && apr()->param('password_confirm')) {
	    if (apr()->param('password') ne apr()->param('password_confirm')) {
		$all_set = 0;
	    } 
	}
	if ((apr()->param('password') && !apr()->param('password_confirm')) || (!apr()->param('password') && apr()->param('password_confirm'))) {
	    $all_set = 0;
	}
	if ($all_set) {
	    # update email and language
	    Debug(5, qq{Updating email and language settings});
	    $dbh->set_user_lang_email($uid, $lang_id, $user_email);
	    if (apr()->param('password') && apr()->param('password') ne '' && apr()->param('password_confirm') && apr()->param('password_confirm') ne '' && apr()->param('password') eq apr()->param('password_confirm')) {
	        Debug(5, qq{Updating password});
		$dbh->set_user_password($uid, apr()->param('password'));
	    }
	} else {
	    my $tpl = new CGI::FastTemplate($cfg->{'cfg'}->{DnsZoneTemplateDir});
	    $tpl->define(layout => 'layout.tpl', settings => 'settings.tpl', menu => 'menu.tpl');
	    $tpl->assign(%lang);
	    $tpl->assign(TITLE => $lang{'PAGE_SETTINGS'});
	    $tpl->assign(DEBUG => '');
	    
	    if ($dbh->get_domain_count($uid) == 1) {
		$tpl->assign(ADDITIONAL_MENU => '');
	    } else {
		$tpl->assign(ADDITIONAL_MENU => qq{<a href="/admin?action=default">$lang{LIST_DOMAIN}</a> | });
	    }

	    $tpl->assign(LANG_VALUE => $dbh->lang_select_box($uid, $lang_id));
	    $tpl->assign(EMAIL_VALUE => encode_entities(apr()->param('user_email')));
	    
	    $tpl->assign(NEW_PASSWORD_VALUE => encode_entities(apr()->param('password')));
	    $tpl->assign(CONFIRM_PASSWORD_VALUE => encode_entities(apr()->param('password_confirm')));
	    
	    if (!($user_email = check_email($user_email))) {
		$tpl->assign(EMAIL => qq{<font color="red">} . $lang{EMAIL} . qq{</font>});
	    }
	    if (!check_lang($lang_id)) {
		$tpl->assign(LANGUAGE => qq{<font color="red">} . $lang{LANGUAGE} . qq{</font>});
	    }
	    if (apr()->param('password') && apr()->param('password') ne '' && apr()->param('password_confirm') && apr()->param('password_confirm') ne '') {
		if (!(apr()->param('password') eq apr()->param('confirm_password'))) {
		    $tpl->assign(NEW_PASSWORD => qq{<font color="red">} . $lang{NEW_PASSWORD} . qq{</font>});
		    $tpl->assign(CONFIRM_PASSWORD => qq{<font color="red">} . $lang{CONFIRM_PASSWORD} . qq{</font>});
		}
	    }
	    if ((apr()->param('password') && !apr()->param('password_confirm')) || (!apr()->param('password') && apr()->param('password_confirm'))) {
		    $tpl->assign(NEW_PASSWORD => qq{<font color="red">} . $lang{NEW_PASSWORD} . qq{</font>});
		    $tpl->assign(CONFIRM_PASSWORD => qq{<font color="red">} . $lang{CONFIRM_PASSWORD} . qq{</font>});
	    }

	    $tpl->parse(MENU => "menu");
	    $tpl->parse(MAIN => ["settings", "layout"]);
	    
	    my $content_ref = $tpl->fetch("MAIN");  
	    
	    output_headers($r, 1, length(${$content_ref}));

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

    my $self = shift;
    my $uid = shift;
    my $lang_id = shift;
    my $email = shift;
    my $sth = $self->{'dbh'}->prepare("update users set lang = ?, email = ? where id = ?");
    $sth->execute($lang_id, $email, $uid);
    $sth->finish();
    return 1;
}

sub set_user_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    my $sth = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
    $sth->execute($password, $uid);
    $sth->finish();
    return 1;
}

sub get_domain_count {
    my $self = shift;
    my $uid = shift;
    return $self->{'dbh'}->selectrow_array("select count(id) from domains where owner = ?", undef, $uid);
}

lib/Apache/DnsZone/DB/MySQL.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    
    my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
    $sth_password_update->execute($password, $uid);
    $sth_password_update->finish();

    return 1;
}

sub domain_stat {
    my $self = shift;
    my $dom_id = shift;
    return $self->{'dbh'}->selectrow_array("select domain,owner from domains where id = ?", undef, $dom_id);
}

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

	$sth->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub set_user_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth->execute($password, $uid);
	$sth->finish();
	$self->{'dbh'}->commit();
    }; 
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

lib/Apache/DnsZone/DB/Oracle.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth_password_update->execute($password, $uid);
	$sth_password_update->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }

    return 1;
}

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

	$sth->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

sub set_user_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth->execute($password, $uid);
	$sth->finish();
	$self->{'dbh'}->commit();
    }; 
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }
    return 1;
}

lib/Apache/DnsZone/DB/Postgresql.pm  view on Meta::CPAN

	if ($lang_id == $l_id) {
	    $lang_select .= qq{ selected};
	}
	$lang_select .= qq{>$l_language ($l_lang)</option>\n};
    }
    $sth_lang->finish();
    $lang_select .= qq{</select>\n};
    return $lang_select;
}

sub update_password {
    my $self = shift;
    my $uid = shift;
    my $password = shift;
    eval {
	my $sth_password_update = $self->{'dbh'}->prepare("update users set password = ? where id = ?");
	$sth_password_update->execute($password, $uid);
	$sth_password_update->finish();
	$self->{'dbh'}->commit();
    };
    if ($@) {
	$self->{'dbh'}->rollback();
	return 0;
    }

    return 1;
}

sql/mysql.sql  view on Meta::CPAN

insert into languages (lang, language, abbrev) values ('de','Deutsch','de');
insert into languages (lang, language, abbrev) values ('dk','Dansk','da');
insert into languages (lang, language, abbrev) values ('it','Italiano','it');
insert into languages (lang, language, abbrev) values ('fr','Fran&ccedil;ais','fr');
insert into languages (lang, language, abbrev) values ('se','Svenska','sv');
insert into languages (lang, language, abbrev) values ('br','Portuguese Brazil','pt-BR');

create table users (
  id integer not null auto_increment,
  username varchar(20) not null,
  password varchar(20) not null,
  email varchar(255) not null,
  lang int(2) not null,
  primary key (id),
  foreign key (lang) references languages (id)
);

create table domains (
  id integer not null auto_increment,
  domain varchar(255) not null,
  owner integer not null,

sql/oracle.sql  view on Meta::CPAN

insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'de','Deutsch','de');
insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'dk','Dansk','da');
insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'it','Italiano','it');
insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'fr','Fran\&ccedil;ais','fr');
insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'se','Svenska','sv');
insert into languages (id, lang, language, abbrev) values (languages_id.nextval,'br','Portuguese Brazil','pt-BR');

create table users (
  id number not null,
  username varchar2(20) not null,
  password varchar2(20) not null,
  email varchar2(255) not null,
  lang number(2) not null
     constraint lang_fk references languages(id),
  constraint users_pk primary key (id)
);

create sequence users_id increment by 1 start with 1;

create table domains (
  id number not null,

sql/postgresql.sql  view on Meta::CPAN

insert into languages (lang, language, abbrev) values ('de','Deutsch','de');
insert into languages (lang, language, abbrev) values ('dk','Dansk','da');
insert into languages (lang, language, abbrev) values ('it','Italiano','it');
insert into languages (lang, language, abbrev) values ('fr','Fran&ccedil;ais','fr');
insert into languages (lang, language, abbrev) values ('se','Svenska','sv');
insert into languages (lang, language, abbrev) values ('br','Portuguese Brazil','pt-BR');

create table users (
  id serial not null,
  username varchar(20) not null,
  password varchar(20) not null,
  email varchar(255) not null,
  lang int not null,
  primary key (id),
  foreign key (lang) references languages(id)
);

create table domains (
  id serial not null,
  domain varchar(255) not null,
  owner integer not null,

templates/standard/login.tpl  view on Meta::CPAN

<br>
<center>
$LOGIN_ERROR
<form action="$FORM_ACTION" method="post">
<input type="hidden" name="destination" value="$DESTINATION">
<p class="login">
<table bgcolor="#CCCCCC" border="0" cellpadding="6" cellspacing="0">
  <tr><td>$USERNAME:</td><td><input type="text" name="credential_0"></td></tr>
  <tr><td>$PASSWORD:</td><td><input type="password" name="credential_1" value=""></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" value="$LOGIN_BUTTON"></td></tr>
</table>
</p>
</form>
<br>
</center>
<center>
$LOGIN_NOTE
</center>

templates/standard/settings.tpl  view on Meta::CPAN

<br><center>
<form action="/admin" method="POST">
<input type="hidden" name="type" value="SETTINGS">
<input type="hidden" name="action" value="settings">
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1">
  <tr><td>$LANGUAGE:</td><td>$LANG_VALUE</td></tr>
  <tr><td>$EMAIL:</td><td><input type="text" name="user_email" value="$EMAIL_VALUE"></td></tr>
  <tr><td colspan="2">$PASSWORD_CHANGE</td></tr>
  <tr><td>$NEW_PASSWORD:</td><td><input type="password" name="password" value="$NEW_PASSWORD_VALUE"></td></tr>
  <tr><td>$CONFIRM_PASSWORD:</td><td><input type="password" name="password_confirm" value="$CONFIRM_PASSWORD_VALUE"></td></tr>
  <tr><td colspan="2" align="right"><input type="submit" name="button" value="$SUBMIT">&nbsp;<input type="submit" name="button" value="$CANCEL"><!--&nbsp;<input type="submit" name="button" value="$HELP">--></td></tr>
</table>
</form>
</center>



( run in 0.711 second using v1.01-cache-2.11-cpan-49f99fa48dc )