.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Authen::Htpasswd::User 3pm" .TH Authen::Htpasswd::User 3pm "2022-11-20" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Authen::Htpasswd::User \- represents a user line in a .htpasswd file .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $user = Authen::Htpasswd::User\->new($username, $password[, @extra_info], \e%options); \& my $user = $pwfile\->lookup_user($username); # from Authen::Htpasswd object \& \& if ($user\->check_password($password)) { ... } \& if ($user\->hashed_password eq $foo) { ... } \& \& # these are written immediately if the user was looked up from an Authen::Htpasswd object \& $user\->username(\*(Aqbill\*(Aq); \& $user\->password(\*(Aqbar\*(Aq); \& $user\->hashed_password(\*(AqtIYAwma5mxexA\*(Aq); \& $user\->extra_info(\*(Aqroot\*(Aq, \*(Aqjoe@site.com\*(Aq, \*(AqJoe Sysadmin\*(Aq); \& $user\->set(username => \*(Aqbill\*(Aq, password => \*(Aqfoo\*(Aq); # set several at once \& \& print $user\->to_line, "\en"; .Ve .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& my $userobj = Authen::Htpasswd::User\->new($username, $password[, @extra_info], \e%options); .Ve .PP Creates a user object. You may also specify the arguments and options together in a hash: \&\f(CW\*(C`{ username => $foo, password => $bar, extra_info => [$email, $name], ... }\*(C'\fR. .IP "encrypt_hash" 4 .IX Item "encrypt_hash" .PD 0 .IP "check_hashes" 4 .IX Item "check_hashes" .PD See Authen::Htpasswd. .IP "hashed_password" 4 .IX Item "hashed_password" Explicitly sets the value of the hashed password, rather than generating it with \f(CW\*(C`password\*(C'\fR. .SS "check_password" .IX Subsection "check_password" .Vb 1 \& $userobj\->check_password($password,\e@check_hashes); .Ve .PP Returns whether the password matches. \f(CW\*(C`check_hashes\*(C'\fR is the same as for Authen::Htpasswd. .SS "username" .IX Subsection "username" .SS "hashed_password" .IX Subsection "hashed_password" .SS "extra_info(@fields)" .IX Subsection "extra_info(@fields)" Get and set the fields of the user line. These methods, as well as \f(CW\*(C`password\*(C'\fR and \f(CW\*(C`set\*(C'\fR below, write any changes immediately if the user was lookup up from an Authen::Htpasswd object. If the username is changed, the old entry is \fInot\fR preserved. .SS "password" .IX Subsection "password" .Vb 1 \& $userobj\->password($newpass); .Ve .PP Encrypts a new password. Dies if \f(CW$newpass\fR is not provided. .SS "set" .IX Subsection "set" .Vb 1 \& $userobj\->set(item => $value, ...); .Ve .PP Sets any of the four preceding values at once. Only writes the file once if it is going to be written. .SS "to_line" .IX Subsection "to_line" .Vb 1 \& $userobj\->to_line; .Ve .PP Returns a line for the user, suitable for printing to a \f(CW\*(C`.htpasswd\*(C'\fR file. There is no newline at the end. .SH "AUTHOR" .IX Header "AUTHOR" David Kamholz \f(CW\*(C`dkamholz@cpan.org\*(C'\fR .PP Yuval Kogman .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" .Vb 1 \& Copyright (c) 2005 \- 2007 the aforementioned authors. \& \& This program is free software; you can redistribute \& it and/or modify it under the same terms as Perl itself. .Ve