package ONO::ToolBox::Auth::PIN;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2022-2026 Jos Kirps and The Joopita Project [ASBL]
# Copyright (C) 2011-2022 Jos Kirps and Joopita Research ASBL
# Copyright (C) 2006-2011 Jos Kirps and The Joopita Project
# Copyright (C) 2001-2006 Jos Kirps and The WobbleWolf Project
#
# This file, as well as many other parts of the ONO Software Project or
# related elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################
use strict;
use ONO::Lib::Web::Cookie;
###############################################################################
# ONO
###############################################################################
sub pin {
#: Check if a website visitor has been identified via PIN code. Note that
#: this feature is not very secure, it should only be used to protect
#: non-relevant information on a website or platform.
my $vars_ref = $_[1];
my %vars = %$vars_ref;
if ($vars{'protection_pin_flags'} =~ /w/) {
my $PIN;
for (my $p = 0; $p < 6; $p++) {
$PIN .= $vars{"protection_pin_$p"};
}
$vars{'cookie_sid'} = ONO::Lib::Web::Cookie->make("ono_web_pin_$vars{'protection_pin_id'}",$PIN,"",$vars_ref);
}
return \%vars;
}
###############################################################################
# end of script
###############################################################################
1;
__END__