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
8e86cbe9
Commit
8e86cbe9
authored
Feb 16, 2016
by
Stephane Glondu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a button to send again a password
parent
de0ef68c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
21 deletions
+41
-21
src/web/web_services.ml
src/web/web_services.ml
+2
-1
src/web/web_site.ml
src/web/web_site.ml
+24
-15
src/web/web_templates.ml
src/web/web_templates.ml
+15
-5
No files found.
src/web/web_services.ml
View file @
8e86cbe9
...
...
@@ -44,7 +44,8 @@ let election_setup_questions_post = post_coservice ~fallback:election_setup_ques
let
election_setup_description
=
post_coservice
~
fallback
:
election_setup
~
post_params
:
(
string
"name"
**
string
"description"
)
()
let
election_setup_voters
=
service
~
path
:
[
"setup"
;
"voters"
]
~
get_params
:
(
uuid
"uuid"
)
()
let
election_setup_voters_add
=
post_service
~
fallback
:
election_setup_voters
~
post_params
:
(
string
"voters"
)
()
let
election_setup_voters_remove
=
post_service
~
fallback
:
election_setup_voters
~
post_params
:
(
string
"voter"
)
()
let
election_setup_voters_remove
=
post_coservice
~
fallback
:
election_setup_voters
~
post_params
:
(
string
"voter"
)
()
let
election_setup_voters_passwd
=
post_coservice
~
fallback
:
election_setup_voters
~
post_params
:
(
string
"voter"
)
()
let
election_setup_trustee_add
=
post_coservice
~
fallback
:
election_setup
~
post_params
:
unit
()
let
election_setup_trustee_del
=
post_coservice
~
fallback
:
election_setup
~
post_params
:
unit
()
let
election_setup_credential_authority
=
service
~
path
:
[
"setup"
;
"credential-authority"
]
~
get_params
:
(
uuid
"uuid"
)
()
...
...
src/web/web_site.ml
View file @
8e86cbe9
...
...
@@ -498,26 +498,28 @@ let generate_password title url id =
send_email
"noreply@belenios.org"
email
subject
body
>>
return
(
salt
,
hashed
)
let
handle_password
se
uuid
~
force
voters
=
let
title
=
se
.
se_questions
.
t_name
in
let
url
=
Eliom_uri
.
make_string_uri
~
absolute
:
true
~
service
:
election_home
(
uuid
,
()
)
|>
rewrite_prefix
in
Lwt_list
.
iter_s
(
fun
id
->
match
id
.
sv_password
with
|
Some
_
when
not
force
->
return_unit
|
None
|
Some
_
->
lwt
x
=
generate_password
title
url
id
.
sv_id
in
return
(
id
.
sv_password
<-
Some
x
)
)
voters
>>
return
(
fun
()
->
T
.
generic_page
~
title
:
"Success"
"Passwords have been generated and mailed!"
()
>>=
Html5
.
send
)
let
()
=
Any
.
register
~
service
:
election_setup_auth_genpwd
(
handle_setup
(
fun
se
()
_
uuid
->
let
title
=
se
.
se_questions
.
t_name
in
let
url
=
Eliom_uri
.
make_string_uri
~
absolute
:
true
~
service
:
election_home
(
uuid
,
()
)
|>
rewrite_prefix
in
Lwt_list
.
iter_s
(
fun
id
->
match
id
.
sv_password
with
|
None
->
lwt
x
=
generate_password
title
url
id
.
sv_id
in
return
(
id
.
sv_password
<-
Some
x
)
|
Some
_
->
return_unit
)
se
.
se_voters
>>
return
(
fun
()
->
T
.
generic_page
~
title
:
"Success"
"Passwords have been generated and mailed!"
()
>>=
Html5
.
send
)))
handle_password
se
uuid
~
force
:
false
se
.
se_voters
))
let
()
=
Any
.
register
...
...
@@ -644,6 +646,13 @@ let () =
)
se
.
se_voters
;
return
(
redir_preapply
election_setup_voters
uuid
))))
let
()
=
Any
.
register
~
service
:
election_setup_voters_passwd
(
handle_setup
(
fun
se
voter
_
uuid
->
let
voter
=
List
.
filter
(
fun
v
->
v
.
sv_id
=
voter
)
se
.
se_voters
in
handle_password
se
uuid
~
force
:
true
voter
))
let
()
=
Redirection
.
register
~
service
:
election_setup_trustee_add
...
...
src/web/web_templates.ml
View file @
8e86cbe9
...
...
@@ -630,15 +630,25 @@ let election_setup_voters uuid se () =
|
Some
[{
auth_system
=
"password"
;
_
}]
->
true
|
_
->
false
in
let
to_string
x
=
match
x
with
|
Some
_
->
"Yes"
|
None
->
"No"
let
mk_regen_passwd
value
=
post_form
~
service
:
election_setup_voters_passwd
~
a
:
[
a_style
"display: inline;"
]
(
fun
name
->
[
string_input
~
input_type
:
`Hidden
~
name
~
value
()
;
string_input
~
input_type
:
`Submit
~
value
:
"Send again"
()
;
]
)
uuid
in
let
format_password_cell
x
=
match
x
.
sv_password
with
|
Some
_
->
[
pcdata
"Yes "
;
mk_regen_passwd
x
.
sv_id
]
|
None
->
[
pcdata
"No"
]
in
let
voters
=
List
.
map
(
fun
v
->
tr
(
[
td
[
pcdata
v
.
sv_id
]]
@
(
if
has_passwords
then
[
td
[
pcdata
(
to_string
v
.
sv_password
)]
]
else
[]
)
@
(
if
has_passwords
then
[
td
(
format_password_cell
v
)
]
else
[]
)
@
(
if
se
.
se_public_creds_received
then
[]
else
[
td
[
mk_remove_button
v
.
sv_id
]])
)
)
se
.
se_voters
...
...
@@ -660,7 +670,7 @@ let election_setup_voters uuid se () =
table
(
tr
(
[
th
[
pcdata
"Identity"
]]
@
(
if
has_passwords
then
[
th
[
pcdata
"Password"
]]
else
[]
)
@
(
if
has_passwords
then
[
th
[
pcdata
"Password
sent?
"
]]
else
[]
)
@
(
if
se
.
se_public_creds_received
then
[]
else
[
th
[
pcdata
"Remove"
]])
)
::
voters
)
]
...
...
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