Index: ow/views/root.py
===================================================================
--- ow/views/root.py	(revision 39b14977ea6c9734e86296a94d7560ff9591a1c9)
+++ ow/views/root.py	(revision 1d92bf2b47c1a3bf1482a589cdd6cc7ec38d552f)
@@ -1,4 +1,4 @@
 from pyramid.view import view_config
-from pyramid_simpleform import Form
+from pyramid_simpleform import Form, State
 from pyramid_simpleform.renderers import FormRenderer
 from pyramid.httpexceptions import HTTPFound
@@ -18,5 +18,5 @@
     Show a list of all the users to admins
     """
-    users = context.users()
+    users = context.users
     return {'users': users}
 
@@ -31,10 +31,12 @@
     Form to add a user
     """
-    form = Form(request, schema=UserAddSchema())
+    state = State(emails=context.lowercase_emails,
+                  names=context.lowercase_nicknames)
+
+    form = Form(request, schema=UserAddSchema(), state=state)
 
     if 'submit' in request.POST and form.validate():
-        uid = request.POST['uid']
-        user = form.bind(User(), exclude=['uid'])
-        context[uid] = user
+        user = form.bind(User())
+        context[str(user.uid)] = user
         return HTTPFound(location=request.resource_url(context, 'userlist'))
 
Index: ow/views/user.py
===================================================================
--- ow/views/user.py	(revision 39b14977ea6c9734e86296a94d7560ff9591a1c9)
+++ ow/views/user.py	(revision 1d92bf2b47c1a3bf1482a589cdd6cc7ec38d552f)
@@ -25,6 +25,11 @@
     """
     if request.authenticated_userid:
-        user = request.root.get_user(request.authenticated_userid)
-        return HTTPFound(location=request.resource_url(user))
+        user = request.root.get_user_by_uid(request.authenticated_userid)
+        if user:
+            return HTTPFound(location=request.resource_url(user))
+        else:
+            # an authenticated user session, for an user that does not exist
+            # anymore, logout!
+            return HTTPFound(location=request.resource_url(context, 'logout'))
     return HTTPFound(location=request.resource_url(context, 'login'))
 
@@ -36,5 +41,5 @@
 def login(context, request):
     message = ''
-    username = ''
+    email = ''
     password = ''
     return_to = request.params.get('return_to')
@@ -42,19 +47,20 @@
 
     if 'submit' in request.POST:
-        username = request.POST.get('username', None)
-        if username in request.root.all_usernames():
-            user = request.root[username]
+        email = request.POST.get('email', None)
+        user = context.get_user_by_email(email)
+        if user:
             password = request.POST.get('password', None)
             if password is not None and user.check_password(password):
-                headers = remember(request, username)
+                headers = remember(request, str(user.uid))
+                redirect_url = return_to or request.resource_url(user)
                 return HTTPFound(location=redirect_url, headers=headers)
             else:
-                message = u'Bad password'
+                message = _('Wrong password')
         else:
-            message = u'Bad username'
+            message = _('Wrong email address')
 
     return {
         'message': message,
-        'username': username,
+        'email': email,
         'password': password,
         'redirect_url': redirect_url
@@ -73,12 +79,11 @@
     renderer='ow:templates/signup.pt')
 def signup(context, request):
-    state = State(emails=context.lowercase_emails(),
-                  names=context.lowercase_usernames())
+    state = State(emails=context.lowercase_emails,
+                  names=context.lowercase_nicknames)
     form = Form(request, schema=SignUpSchema(), state=state)
 
     if 'submit' in request.POST and form.validate():
-        username = request.POST['username']
-        user = form.bind(User(), exclude=['username', 'password_confirm'])
-        context[username] = user
+        user = form.bind(User(), exclude=['password_confirm'])
+        context.add_user(user)
         # Send to login
         return HTTPFound(location=request.resource_url(context))
