Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
e5964b57
Commit
e5964b57
authored
Apr 27, 2016
by
Francesc Guasch
Browse files
add user in db from command line
parent
d01453a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Auth.pm
View file @
e5964b57
...
...
@@ -7,11 +7,18 @@ our $LDAP;
use
Ravada::Auth::
SQL
;
eval
{
require
Ravada::Auth::
LDAP
;
$LDAP
=
1
};
eval
{
require
Ravada::Auth::
LDAP
;
$LDAP
=
1
};
sub
init
{
my
(
$config
,
$db_con
)
=
@_
;
Ravada::Auth::LDAP::
init
(
$config
)
if
$LDAP
;
if
(
$config
->
{
ldap
})
{
Ravada::Auth::LDAP::
init
(
$config
);
}
else
{
$LDAP
=
0
;
}
Ravada::Auth::SQL::
init
(
$config
,
$db_con
);
}
...
...
lib/Ravada/Auth/SQL.pm
View file @
e5964b57
...
...
@@ -17,7 +17,7 @@ sub add_user {
my
$sth
=
$CON
->
dbh
->
prepare
(
"
INSERT INTO users (name,password) VALUES(?,?)
");
$sth
->
execute
(
sha1_hex
(
$password
));
$sth
->
execute
(
$login
,
sha1_hex
(
$password
));
$sth
->
finish
;
}
...
...
@@ -26,7 +26,7 @@ sub login {
my
$sth
=
$CON
->
dbh
->
prepare
(
"
SELECT name FROM users WHERE name=? AND password=?
");
$sth
->
execute
(
sha1_hex
(
$password
));
$sth
->
execute
(
$login
,
sha1_hex
(
$password
));
my
(
$found
)
=
$sth
->
fetchrow
;
$sth
->
finish
;
return
if
!
$found
;
...
...
rvd_front.pl
View file @
e5964b57
...
...
@@ -11,7 +11,7 @@ use lib 'lib';
use
Ravada::
Auth
;
my
$FILE_CONFIG
=
"
/etc/ravada.conf
";
my
$FILE_CONFIG
=
"
/etc/ravada
_front
.conf
";
my
$help
;
GetOptions
(
config
=>
\
$FILE_CONFIG
...
...
@@ -39,6 +39,11 @@ any '/' => sub {
return
quick_start
(
$c
);
};
any
'
/login
'
=>
sub
{
my
$c
=
shift
;
$c
->
render
(
data
=>
"
TODO
");
};
any
'
/logout
'
=>
sub
{
my
$c
=
shift
;
$c
->
session
(
expires
=>
1
);
...
...
@@ -250,7 +255,7 @@ sub list_bases {
}
sub
init
{
Ravada::Auth::
init
(
$config
);
Ravada::Auth::
init
(
$config
,
$CON
);
}
app
->
start
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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