« blib/lib/Lemonldap/NG/Portal/Lib/2fDevices.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Auth/Twitter.pm »
| 1 | ##@file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Web form authentication backend file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ##@class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Web form authentication backend class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | package Lemonldap::NG::Portal::Auth::_WebForm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 329 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 329 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 329 | ▶ | use Lemonldap::NG::Portal::Main::Constants qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | PE_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | PE_NOTOKEN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | PE_FORMEMPTY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | PE_FIRSTACCESS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | PE_CAPTCHAEMPTY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | PE_CAPTCHAERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | PE_TOKENEXPIRED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | PE_MALFORMEDUSER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | PE_PASSWORDFORMEMPTY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 329 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 329 | our $VERSION = '2.21.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 329 | extends qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | Lemonldap::NG::Portal::Main::Auth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | Lemonldap::NG::Portal::Lib::_tokenRule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | has authnLevel => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 71 | ▶ | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 71 | my $conf = $_[0]->{conf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 71 | ▶ | return ( $conf->{portal} =~ /^https/ ? 2 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 329 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 329 | has captcha => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 329 | has ott => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # INITIALIZATION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 812 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 812 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $self->captcha( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | $self->p->buildRule( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $self->{conf}->{captcha_login_enabled}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 812 | 'captchaLogin' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 812 | ▶ | return 0 unless $self->captcha; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 812 | ▶ | unless ($self->{conf}->{captcha_login_enabled} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"conf"}{"captcha_login_enabled"} and $self->{"conf"}{"captcha_login_enabled"} eq 0
MC/DC0%0/2
$self->{"conf"}{"captcha_login_enabled"} and $self->{"conf"}{"captcha_login_enabled"} eq 0
$self->{"conf"}{"captcha_login_enabled"}
$self->{"conf"}{"captcha_login_enabled"} eq 0
Truth table66%2/3
A and B
A= $self->{"conf"}{"captcha_login_enabled"}B= $self->{"conf"}{"captcha_login_enabled"} eq 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | and $self->{conf}->{captcha_login_enabled} eq '0' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 812 | ▶ | $self->ott( $self->p->loadModule('::Lib::OneTimeToken') ) or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 812 | $self->ott->timeout( $self->conf->{formTimeout} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 812 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # RUNNING METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Read username and password from POST data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 234 | ▶ | sub extractFormInfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extractFormInfo: called CC=27 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 234 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 234 | ▶ | if ( $req->param('user') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 155 | ▶ | unless ( $req->param('user') =~ /$self->{conf}->{userControl}/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->setSecurity($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return PE_MALFORMEDUSER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Detect first access and empty forms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 234 | my $defUser = defined $req->param('user'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 234 | my $defPassword = defined $req->param('password'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 234 | my $defOldPassword = defined $req->param('oldpassword'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 234 | my $res = PE_OK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # 1. No user defined at all -> first access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # _pwdCheck is a workaround to make CheckUser work while using a GET | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 234 | ▶ | unless ( $defUser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition50%3/6
$defUser and uc $req->method eq "POST" || $req->data->{"_pwdCheck"}
uc $req->method eq "POST" or $req->data->{"_pwdCheck"}
MC/DC33%1/3
$defUser and uc $req->method eq "POST" || $req->data->{"_pwdCheck"}
$defUser
uc $req->method eq "POST"
$req->data->{"_pwdCheck"}
Truth table50%2/4
A and B or C
A= $defUserB= uc $req->method eq "POST"C= $req->data->{"_pwdCheck"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | and ( uc( $req->method ) eq "POST" or $req->data->{_pwdCheck} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 79 | $res = PE_FIRSTACCESS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # 2. If user and password defined -> login form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ▶ | elsif ( $defUser and $defPassword ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$defUser and $defPassword
MC/DC0%0/2
$defUser and $defPassword
$defUser
$defPassword
Truth table33%1/3
A and B
A= $defUserB= $defPassword
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | $res = PE_FORMEMPTY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | unless ( ( $req->{user} = $req->param('user') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 155 | ▶ | && ( $req->data->{password} = $req->param('password') ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$req->{"user"} = $req->param("user") and $req->data->{"password"} = $req->param("password")
MC/DC0%0/2
$req->{"user"} = $req->param("user") and $req->data->{"password"} = $req->param("password")
$req->{"user"} = $req->param("user")
$req->data->{"password"} = $req->param("password")
Truth table33%1/3
A and B
A= $req->{"user"} = $req->param("user")B= $req->data->{"password"} = $req->param("password")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # 3. If user and oldpassword defined -> password form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ▶ | elsif ( $defUser and $defOldPassword ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$defUser and $defOldPassword
MC/DC0%0/2
$defUser and $defOldPassword
$defUser
$defOldPassword
Truth table0%0/3
A and B
A= $defUserB= $defOldPassword
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | $res = PE_PASSWORDFORMEMPTY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | unless ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ( $req->{user} = $req->param('user') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | && ( $req->data->{oldpassword} = $req->param('oldpassword') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | && ( $req->data->{newpassword} = $req->param('newpassword') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | && ( $req->data->{confirmpassword} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $req->param('confirmpassword') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$req->{"user"} = $req->param("user") and $req->data->{"oldpassword"} = $req->param("oldpassword") and $req->data->{"newpassword"} = $req->param("newpassword") and $req->data->{"confirmpassword"} = $req->param("confirmpassword")
$req->{"user"} = $req->param("user") and $req->data->{"oldpassword"} = $req->param("oldpassword") and $req->data->{"newpassword"} = $req->param("newpassword")
$req->{"user"} = $req->param("user") and $req->data->{"oldpassword"} = $req->param("oldpassword")
MC/DC0%0/4
$req->{"user"} = $req->param("user") and $req->data->{"oldpassword"} = $req->param("oldpassword") and $req->data->{"newpassword"} = $req->param("newpassword") and $req->data->{"confirmpassword"} = $req->param("confirmpassword")
$req->{"user"} = $req->param("user")
$req->data->{"oldpassword"} = $req->param("oldpassword")
$req->data->{"newpassword"} = $req->param("newpassword")
$req->data->{"confirmpassword"} = $req->param("confirmpassword")
Truth table0%0/5
A and B and C and D
A= $req->{"user"} = $req->param("user")B= $req->data->{"oldpassword"} = $req->param("oldpassword")C= $req->data->{"newpassword"} = $req->param("newpassword")D= $req->data->{"confirmpassword"} = $req->param("confirmpassword")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # If form seems empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 234 | ▶ | if ( $res != PE_OK ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 79 | $self->setSecurity($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 79 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # Security: check for captcha or token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 155 | my $needCaptcha = $self->captcha->( $req, {} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 155 | ▶ | if ( not $req->data->{'skipToken'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not $req->data->{"skipToken"} and $needCaptcha || $self->ottRule->($req, scalar {})
$needCaptcha or $self->ottRule->($req, scalar {})
MC/DC100%3/3
not $req->data->{"skipToken"} and $needCaptcha || $self->ottRule->($req, scalar {})
not $req->data->{"skipToken"}
$needCaptcha
$self->ottRule->($req, scalar {})
Truth table100%4/4
not(A) and B or C
A= not $req->data->{"skipToken"}B= $needCaptchaC= $self->ottRule->($req, scalar {})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | and ( $needCaptcha or $self->ottRule->( $req, {} ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 13 | my $token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 13 | ▶ | unless ( $token = $req->param('token') or $needCaptcha ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$token = $req->param("token") or $needCaptcha
MC/DC0%0/2
$token = $req->param("token") or $needCaptcha
$token = $req->param("token")
$needCaptcha
Truth table66%2/3
A or B
A= $token = $req->param("token")B= $needCaptcha
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->userLogger->error('Authentication tried without token'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self->ott->setToken($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return PE_NOTOKEN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 13 | ▶ | if ($needCaptcha) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | my $result = $self->p->getService('captcha')->check_captcha($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | ▶ | if ($result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | $self->logger->debug("Captcha code verified"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | $self->p->getService('captcha')->init_captcha($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | $self->userLogger->warn("Captcha failed"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | return PE_CAPTCHAERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | elsif ( $self->ottRule->( $req, {} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 10 | ▶ | unless ( $req->data->{tokenVerified} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$req->data->{"tokenVerified"} or $self->ott->getToken($token)
MC/DC0%0/2
$req->data->{"tokenVerified"} or $self->ott->getToken($token)
$req->data->{"tokenVerified"}
$self->ott->getToken($token)
Truth table66%2/3
A or B
A= $req->data->{"tokenVerified"}B= $self->ott->getToken($token)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | or $self->ott->getToken($token) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $self->ott->setToken($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->userLogger->warn('Invalid authentication form token'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return PE_TOKENEXPIRED; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 10 | $req->data->{tokenVerified} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # Other parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 153 | $req->data->{timezone} = $req->param('timezone'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 153 | return PE_OK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Set password in session data if wanted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 132 | ▶ | sub setAuthSessionInfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setAuthSessionInfo: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 132 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # authenticationLevel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 132 | $req->{sessionInfo}->{authenticationLevel} = $self->authnLevel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # Store submitted password if set in configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # WARNING: it can be a security hole | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 132 | ▶ | if ( $self->conf->{storePassword} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | my $passwordToStore = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | ▶ | $req->data->{'newpassword'} || $req->data->{'password'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$req->data->{'newpassword'} || $req->data->{'password'}
MC/DC0%0/2
$req->data->{'newpassword'} || $req->data->{'password'}
$req->data->{'newpassword'}
$req->data->{'password'}
Truth table33%1/3
A || B
A= $req->data->{'newpassword'}B= $req->data->{'password'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $req->{sessionInfo}->{'_password'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | $self->conf->{storePasswordEncrypted} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | ▶ | ? $self->p->HANDLER->tsv->{cipher}->encrypt($passwordToStore) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | : $passwordToStore; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # Store user timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 132 | $req->{sessionInfo}->{'_timezone'} = $self->{'timezone'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 132 | return PE_OK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # @return display type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 157 | ▶ | sub getDisplayType { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getDisplayType: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 157 | return "standardform"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 112 | ▶ | sub setSecurity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setSecurity: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 112 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 112 | ▶ | return if $req->data->{skipToken}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # If captcha is enable, prepare it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 112 | ▶ | if ( $self->captcha->( $req, {} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | $self->p->getService('captcha')->init_captcha($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # Else get token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | elsif ( $self->ottRule->( $req, {} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 15 | $self->ott->setToken($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # DEPRECATED, use get2fTplParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub getFormParams { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFormParams: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $checkLogins = $req->param('checkLogins'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | $self->logger->debug( $self->prefix . '2f: checkLogins set' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | if $checkLogins; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $stayConnected = $req->param('stayconnected'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | $self->logger->debug( $self->prefix . '2f: stayConnected set' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | if $stayConnected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return ( $checkLogins, $stayConnected ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 329 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||