Index: server/trunk/web/lib/Sophie/Controller/Admin.pm
===================================================================
--- server/trunk/web/lib/Sophie/Controller/Admin.pm	(revision 209)
+++ server/trunk/web/lib/Sophie/Controller/Admin.pm	(revision 211)
@@ -327,4 +327,23 @@
 }
 
+sub set_user_password : XMLRPC {
+    my ( $self, $c, $user, $password ) = @_;
+
+    $c->forward('/user/set_user_password', $user, $password);
+}
+
+sub create_user : XMLRPC {
+    my ($self, $c, $user, $password) = @_;
+
+    if ($c->model('Base::Users')->create({
+            mail => $user,
+        })) {
+        $c->forward('set_user_password', [ $user, $password ]);
+        return $c->stash->{xmlrpc} = "User $user created";
+    } else {
+        return;
+    }
+}
+
 =head1 AUTHOR
 
Index: server/trunk/web/lib/Sophie/Controller/Login.pm
===================================================================
--- server/trunk/web/lib/Sophie/Controller/Login.pm	(revision 209)
+++ server/trunk/web/lib/Sophie/Controller/Login.pm	(revision 211)
@@ -24,22 +24,53 @@
 sub index :Path :Args(0) :XMLRPCPath('/login') {
     my ( $self, $c, $login, $password ) = @_;
+    $login ||= $c->req->param('username');
+    $password ||= $c->req->param('password');
 
-    if ($c->authenticate({
-            mail => $login || $c->req->param('username'),
-            password => $password || $c->req->param('password'),
-        }
-    )) {
-        if ($c->req->xmlrpc->is_xmlrpc_request) {
-            $c->stash->{xmlrpc} = 'sophie_session=' . $c->sessionid;
+    if ($login) {
+        if ($c->authenticate({
+                mail => $login,
+                password => $password,
+            }
+        )) {
+            if ($c->req->xmlrpc->is_xmlrpc_request) {
+                $c->stash->{xmlrpc} = 'sophie_session=' . $c->sessionid;
+            } else {
+                warn 'redirect';
+                $c->res->redirect($c->uri_for('/'));
+            }
         } else {
-            $c->res->redirect('/');
-        }
-    } else {
-        if ($c->req->xmlrpc->is_xmlrpc_request) {
-            $c->error('invalid login / password');
+            if ($c->req->xmlrpc->is_xmlrpc_request) {
+                $c->error('invalid login / password');
+            }
         }
     }
 }
 
+sub create :Local {
+    my ($self, $c) = @_;
+
+    warn $c->req->param('valid');
+    warn $c->session->{valid_create_user};
+    if ((my $valid = $c->req->param('valid')) && $c->req->param('username')) {
+       if ($valid == $c->session->{valid_create_user}) {
+           my $res = $c->forward('/admin/create_user',
+               [
+                   $c->req->param('username'),
+                   $c->req->param('password'),
+               ]
+            );
+            if ($res) {
+               $c->res->redirect($c->uri_for('/login',
+                   { username => $c->req->param('username') }
+               ));
+           }
+       }
+    }
+    my $aa = (0 .. 9)[rand(9)];
+    my $bb = (0 .. 9)[rand(9)];
+    $c->stash->{valid} = "$aa + $bb";
+    $c->session->{valid_create_user} = $aa + $bb;
+
+}
 
 =head1 AUTHOR
Index: server/trunk/web/root/static/sophie.css
===================================================================
--- server/trunk/web/root/static/sophie.css	(revision 209)
+++ server/trunk/web/root/static/sophie.css	(revision 211)
@@ -252,4 +252,18 @@
 }
 
+div.sophie_auth {
+    width: 40%;
+    margin: auto;
+}
+
+.sophie_auth label {
+    width: 10em;
+    display: block;
+    float:left;
+}
+
+.sophie_auth input {
+}
+
 #w3c {
     float: right;
Index: server/trunk/web/root/templates/html/login/create.html
===================================================================
--- server/trunk/web/root/templates/html/login/create.html	(revision 211)
+++ server/trunk/web/root/templates/html/login/create.html	(revision 211)
@@ -0,0 +1,3 @@
+<!-- $Id$ -->
+
+[% INCLUDE 'login/create.tt' %]
Index: server/trunk/web/root/templates/html/login/create.tt
===================================================================
--- server/trunk/web/root/templates/html/login/create.tt	(revision 211)
+++ server/trunk/web/root/templates/html/login/create.tt	(revision 211)
@@ -0,0 +1,13 @@
+<!-- $Id$ -->
+
+<div id="sophie_create_user" class="sophie_auth">
+<p>Create a new user:</p>
+<form action="[% c.uri_for('/login/create') %]">
+    <label for="username">Username:</label>
+        <input type="text" id="username" name="username" value="[% c.req.param('username') %]"><br>
+    <label for="password">Password:</label> <input type="password" name="password"><br>
+    <p>Please enter the result of [% valid | html %]:</p>
+    <input type="text" name="valid">
+    <input type="submit"> 
+</form>
+</div>
Index: server/trunk/web/root/templates/html/login/index.html
===================================================================
--- server/trunk/web/root/templates/html/login/index.html	(revision 209)
+++ server/trunk/web/root/templates/html/login/index.html	(revision 211)
@@ -1,1 +1,13 @@
 <!-- $id$ -->
+
+<div id="sophie_authenticated" class="sophie_auth">
+<form action="[% c.uri_for('/login') %]" method="POST">
+    <p>Authenticate to Sophie:</p>
+    <label for="username">Login:</label> <input type="text" id="username" name="username" value="[% c.req.param('username') %]"><br>
+    <label for="passowrd">Password:</label> <input id="password" type="password" name="password" value=""><br>
+    <input type="submit">
+</form>
+
+<p>No account yet: create one <a href="[% c.uri_for('/login/create')
+    %]">here</a>.</p>
+</div>
