Index: /trunk/epoll.yml.example
===================================================================
--- /trunk/epoll.yml.example	(revision 306)
+++ /trunk/epoll.yml.example	(revision 307)
@@ -6,2 +6,5 @@
 # The smtp serveur to use, default is localhost
 smtp:
+# This change the poll creation behavior, instead ask want confirmation by mail
+# it ask for this password (in clear)
+# newpollpasswd:
Index: /trunk/lib/Epoll/Controller/Newpoll.pm
===================================================================
--- /trunk/lib/Epoll/Controller/Newpoll.pm	(revision 306)
+++ /trunk/lib/Epoll/Controller/Newpoll.pm	(revision 307)
@@ -33,21 +33,39 @@
     $c->stash->{page}{title} = 'CrÃ©er un nouveau vote';
     if ($c->req->param('mail')) {
-        my $reqid = $c->model('Vote')->create_poll_request(
-            mail => $c->req->param('mail'),
-            label => $c->req->param('label'),
-        );
-        $c->forward(
-            q'Epoll::View::Mail', 'render',
-            [ 'poll_request.tt', {
-                To => $c->req->param('mail'),
-                Subject => "New poll request",
-                mail => {
-                    label => $c->req->param('label'),
-                    reqid => $reqid,
+        if ($c->config->{newpollpasswd}) {
+            if (($c->req->param('passwd') || '') eq $c->config->{newpollpasswd})
+                {
+                    if (my $pid = $c->model('Vote')->create_poll(
+                            $c->req->param('label'),
+                            $c->req->param('mail'),
+                            $c->req->param('vpasswd'),
+                        )
+                    ) {
+                        $c->session->{'vpass' . $pid} = $c->req->param('vpasswd'); # avoid auth on admin page
+                        $c->res->redirect($c->uri_for('/admin',
+                                $c->model('Vote')->poll_id_from_uid($pid))
+                        );
+                    }
+                } else {
+                    $c->stash->{passwderror} = 1;
                 }
-            } ]
-        );
-
-        $c->stash->{template} = 'newpoll/request.tt';
+        } else {
+            my $reqid = $c->model('Vote')->create_poll_request(
+                mail => $c->req->param('mail'),
+                label => $c->req->param('label'),
+            );
+            $c->forward(
+                q'Epoll::View::Mail', 'render',
+                [ 'poll_request.tt', {
+                    To => $c->req->param('mail'),
+                    Subject => "New poll request",
+                    mail => {
+                        label => $c->req->param('label'),
+                        reqid => $reqid,
+                    }
+                } ]
+            );
+            $c->stash->{template} = 'newpoll/request.tt';
+        }
     }
 
Index: /trunk/lib/Epoll/DB.pm
===================================================================
--- /trunk/lib/Epoll/DB.pm	(revision 306)
+++ /trunk/lib/Epoll/DB.pm	(revision 307)
@@ -158,5 +158,5 @@
     my $rinfo = $self->poll_request_info($rid) or return;
 
-    my $pollid = $self->create_poll($rinfo->{mail}, $rinfo->{label}, $passwd);
+    my $pollid = $self->_create_poll($rinfo->{mail}, $rinfo->{label}, $passwd);
     
     my $delreq = $self->db->prepare_cached(
@@ -170,4 +170,11 @@
 
 sub create_poll {
+    my ($self, @args) = @_;
+    my $uid = $self->_create_poll(@args);
+    $self->commit;
+    $uid;
+}
+
+sub _create_poll {
     my ($self, $mail, $label, $passwd) = @_;
 
@@ -191,5 +198,4 @@
         return;
     };
-
 
     $newpollid
Index: /trunk/lib/Epoll/I18N/fr.po
===================================================================
--- /trunk/lib/Epoll/I18N/fr.po	(revision 306)
+++ /trunk/lib/Epoll/I18N/fr.po	(revision 307)
@@ -221,4 +221,9 @@
 "Ã  participer Ã  ce vote ?"
 
+#: root/templates/newpoll/index.tt:21
+#, fuzzy
+msgid "Invalid site password:"
+msgstr "envoyer les mots de passe"
+
 #: root/templates/admin/date.tt:31
 msgid "Jan"
@@ -343,7 +348,12 @@
 msgstr "A participÃ©"
 
-#: root/templates/newpoll/index.tt:12
+#: root/templates/newpoll/index.tt:27
 msgid "Password"
 msgstr "Mot de passe"
+
+#: root/templates/newpoll/index.tt:16
+#, fuzzy
+msgid "Password of this poll:"
+msgstr "Oui, dÃ©truire ce vote"
 
 #: root/templates/ballot/login.tt:17
@@ -368,5 +378,5 @@
 msgstr "Le vote est en cours"
 
-#: root/templates/newpoll/index.tt:10
+#: root/templates/newpoll/index.tt:12
 msgid "Poll name:"
 msgstr "Nom du vote:"
@@ -408,4 +418,9 @@
 msgid "September"
 msgstr "Septembre"
+
+#: root/templates/newpoll/index.tt:24
+#, fuzzy
+msgid "Site password:"
+msgstr "envoyer les mots de passe"
 
 #: root/templates/admin/includes/ballot_validation.tt:8
Index: /trunk/lib/Epoll/I18N/messages.pot
===================================================================
--- /trunk/lib/Epoll/I18N/messages.pot	(revision 306)
+++ /trunk/lib/Epoll/I18N/messages.pot	(revision 307)
@@ -217,4 +217,8 @@
 msgstr ""
 
+#: root/templates/newpoll/index.tt:21
+msgid "Invalid site password:"
+msgstr ""
+
 #: root/templates/admin/date.tt:31
 msgid "Jan"
@@ -338,6 +342,10 @@
 msgstr ""
 
-#: root/templates/newpoll/index.tt:12
+#: root/templates/newpoll/index.tt:27
 msgid "Password"
+msgstr ""
+
+#: root/templates/newpoll/index.tt:16
+msgid "Password of this poll:"
 msgstr ""
 
@@ -363,5 +371,5 @@
 msgstr ""
 
-#: root/templates/newpoll/index.tt:10
+#: root/templates/newpoll/index.tt:12
 msgid "Poll name:"
 msgstr ""
@@ -402,4 +410,8 @@
 #: root/templates/admin/date.tt:25
 msgid "September"
+msgstr ""
+
+#: root/templates/newpoll/index.tt:24
+msgid "Site password:"
 msgstr ""
 
Index: /trunk/root/templates/newpoll/index.tt
===================================================================
--- /trunk/root/templates/newpoll/index.tt	(revision 306)
+++ /trunk/root/templates/newpoll/index.tt	(revision 307)
@@ -7,6 +7,21 @@
 <table border="0">
 <tbody align="center">
-<tr><th>[% l('Your mail:') %]</th><td><input type="text" name="mail" tabindex="1" size="45" maxlength="150"></td></tr>
-<tr><th>[% l('Poll name:') %]</th><td><input type="text" name="label" tabindex="2" size="45" maxlength="150"></td></tr>
+<tr><th>[% l('Your mail:') %]</th><td>
+  <input type="text" name="mail" value="[% c.req.param('mail') | html %]" tabindex="1" size="45" maxlength="150">
+</td></tr>
+<tr><th>[% l('Poll name:') %]</th><td>
+  <input type="text" name="label" value="[% c.req.param('label') | html %]" tabindex="2" size="45" maxlength="150">
+</td></tr>
+[% IF c.config.newpollpasswd %]
+<tr><th>[% l('Password of this poll:') %]</th><td>
+  <input type="password" name="vpasswd" value="[% c.req.param('vpasswd') | html %]"  tabindex="3">
+</td></tr>
+[% IF passwderror %]
+<tr><td colspan="2" class="alert">
+    [% l('Invalid site password:') %]
+</td></tr>
+[% END %]
+<tr><th>[% l('Site password:') %]</th><td><input type="password" name="passwd" tabindex="4"></td></tr>
+[% END %]
 <!-- Cf http://forge.ipsl.jussieu.fr/epoll/ticket/1
 <tr><th>[% l('Password') %]</th><td><input type="password" name="vpasswd"></td></tr>
