Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
belenios
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
belenios
belenios
Commits
6dc2ce79
Commit
6dc2ce79
authored
Nov 05, 2015
by
Stephane Glondu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dump passwords to disk
parent
05e8536b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
src/web/web_site.ml
src/web/web_site.ml
+25
-5
No files found.
src/web/web_site.ml
View file @
6dc2ce79
...
...
@@ -106,6 +106,13 @@ let find_election =
let
cache
=
new
WCache
.
cache
raw_find_election
100
in
fun
x
->
cache
#
find
x
let
dump_passwords
dir
table
uuid
=
Lwt_io
.(
with_file
Output
(
dir
/
"passwords.csv"
)
(
fun
oc
->
Ocsipersist
.
iter_step
(
fun
voter
(
salt
,
hashed
)
->
write_line
oc
(
voter
^
","
^
salt
^
","
^
hashed
)
)
table
))
(* Mutex to avoid simultaneous registrations of the same election *)
let
registration_mutex
=
Lwt_mutex
.
create
()
...
...
@@ -222,6 +229,12 @@ let import_election f =
Lwt_stream
.
iter_s
W
.
B
.
inject_cred
>>
W
.
B
.
update_files
()
>>
Ocsipersist
.
add
election_ptable
uuid
(
raw_election
,
web_params
)
>>
(
let
table
=
"password_"
^
underscorize
uuid
in
let
table
=
Ocsipersist
.
open_table
table
in
lwt
size
=
Ocsipersist
.
length
table
in
if
size
>
0
then
dump_passwords
dir
table
uuid
else
return_unit
)
>>
let
()
=
Lwt_mutex
.
unlock
registration_mutex
in
return
(
module
W
:
WEB_ELECTION
)
with
e
->
...
...
@@ -503,11 +516,8 @@ let () =
~
service
:
election_setup_auth_genpwd
(
handle_setup
(
fun
se
()
_
uuid
->
let
table
=
"password_"
^
let
u
=
Uuidm
.
to_string
uuid
in
underscorize
u
in
let
uuid_s
=
Uuidm
.
to_string
uuid
in
let
table
=
"password_"
^
underscorize
uuid_s
in
let
title
=
se
.
se_questions
.
t_name
in
let
url
=
Eliom_uri
.
make_string_uri
~
absolute
:
true
~
service
:
election_home
...
...
@@ -545,6 +555,7 @@ let () =
begin
try_lwt
lwt
_
=
Ocsipersist
.
find
table
user
in
generate_password
table
title
url
user
>>
dump_passwords
W
.
dir
table
uuid_s
>>
T
.
generic_page
~
title
:
"Success"
(
"A new password has been mailed to "
^
user
^
"."
)
()
>>=
Html5
.
send
...
...
@@ -1438,3 +1449,12 @@ lwt () =
write_line
oc
raw_metadata
))
)
election_ptable
lwt
()
=
Ocsipersist
.
iter_step
(
fun
uuid
(
_
,
web_params
)
->
let
module
P
=
(
val
web_params
:
WEB_PARAMS
)
in
let
table
=
"password_"
^
underscorize
uuid
in
let
table
=
Ocsipersist
.
open_table
table
in
lwt
size
=
Ocsipersist
.
length
table
in
if
size
>
0
then
dump_passwords
P
.
dir
table
uuid
else
return_unit
)
election_ptable
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