Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maxime Besson
lemonldap-ng
Commits
7802cbcc
Commit
7802cbcc
authored
Feb 16, 2019
by
Christophe Maudoux
🐛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optionaly let Ext2F module handle code generation (#1632)
parent
90ddec7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm
+12
-9
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm
View file @
7802cbcc
...
@@ -33,9 +33,11 @@ sub init {
...
@@ -33,9 +33,11 @@ sub init {
if
(
$self
->
conf
->
{
ext2fLogo
}
);
if
(
$self
->
conf
->
{
ext2fLogo
}
);
return
$self
->
SUPER::
init
();
return
$self
->
SUPER::
init
();
}
}
if
(
$self
->
conf
->
{
ext2fCodeActivation
}
if
(
$self
->
conf
->
{
ext2fCodeActivation
}
)
{
and
$self
->
conf
->
{
ext2FSendCommand
}
)
unless
(
$self
->
conf
->
{
ext2FSendCommand
}
)
{
{
$self
->
error
("
Missing 'ext2FSendCommand' parameter, aborting
");
return
0
;
}
$self
->
random
(
String::
Random
->
new
);
$self
->
random
(
String::
Random
->
new
);
$self
->
logo
(
$self
->
conf
->
{
ext2fLogo
}
)
$self
->
logo
(
$self
->
conf
->
{
ext2fLogo
}
)
if
(
$self
->
conf
->
{
ext2fLogo
}
);
if
(
$self
->
conf
->
{
ext2fLogo
}
);
...
@@ -52,10 +54,11 @@ sub run {
...
@@ -52,10 +54,11 @@ sub run {
my
$checkLogins
=
$req
->
param
('
checkLogins
');
my
$checkLogins
=
$req
->
param
('
checkLogins
');
$self
->
logger
->
debug
("
Ext2F checkLogins set
")
if
(
$checkLogins
);
$self
->
logger
->
debug
("
Ext2F checkLogins set
")
if
(
$checkLogins
);
# Generate OTP to send
# Generate Code to send
if
(
$self
->
{
random
}
)
{
my
$code
;
my
$code
if
(
$self
->
conf
->
{
ext2fCodeActivation
}
)
{
=
$self
->
random
->
randregex
(
$self
->
conf
->
{
ext2fOTPActivation
}
);
$code
=
$self
->
random
->
randregex
(
$self
->
conf
->
{
ext2fCodeActivation
}
);
$self
->
logger
->
debug
("
Generated ext2f code :
$code
");
$self
->
logger
->
debug
("
Generated ext2f code :
$code
");
$self
->
ott
->
updateToken
(
$token
,
__ext2fcode
=>
$code
);
$self
->
ott
->
updateToken
(
$token
,
__ext2fcode
=>
$code
);
}
}
...
@@ -64,7 +67,7 @@ sub run {
...
@@ -64,7 +67,7 @@ sub run {
$self
->
logger
->
debug
(
'
Launching "Send" external 2F command ->
'
$self
->
logger
->
debug
(
'
Launching "Send" external 2F command ->
'
.
$self
->
conf
->
{
ext2FSendCommand
}
);
.
$self
->
conf
->
{
ext2FSendCommand
}
);
if
(
my
$c
if
(
my
$c
=
$self
->
launch
(
$req
->
sessionInfo
,
$self
->
conf
->
{
ext2FSendCommand
}
)
=
$self
->
launch
(
$req
->
sessionInfo
,
$self
->
conf
->
{
ext2FSendCommand
}
,
$code
)
)
)
{
{
$self
->
logger
->
error
("
External send command failed (code
$c
)
");
$self
->
logger
->
error
("
External send command failed (code
$c
)
");
...
@@ -92,7 +95,7 @@ sub verify {
...
@@ -92,7 +95,7 @@ sub verify {
my
(
$self
,
$req
,
$session
)
=
@_
;
my
(
$self
,
$req
,
$session
)
=
@_
;
my
$usercode
;
my
$usercode
;
unless
(
$usercode
=
$req
->
param
('
code
')
)
{
unless
(
$usercode
=
$req
->
param
('
code
')
)
{
$self
->
userLogger
->
error
('
External 2F: no code
');
$self
->
userLogger
->
error
('
External 2F: no code
found
');
return
PE_FORMEMPTY
;
return
PE_FORMEMPTY
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment