]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/registry.py
Add an OSM authentication provider
[osqa.git] / forum / registry.py
index 4c8df6531d46a342a286d197c43555fb23a92030..7fb8292fd882bb35dc99b5920f9f5d99e8e69164 100644 (file)
@@ -25,10 +25,15 @@ ui.register(ui.HEADER_LINKS,
             ui.Link(_('about'), ui.Url('about'), weight=300, name='ABOUT'),
 
             ui.Link(
-                    text=lambda u, c: u.is_authenticated() and _('logout') or _('login'),
-                    url=lambda u, c: u.is_authenticated() and reverse('logout') or reverse('auth_signin'),
-                    weight=200, name='LOGIN/OUT'),
-
+                    visibility=ui.Visibility.ANONYMOUS,
+                    text=_('login'),
+                    url=lambda u, c: reverse('auth_signin'),
+                    weight=200, name='LOGIN'),
+            ui.Link(
+                    visibility=ui.Visibility.AUTHENTICATED,
+                    text=_('logout'),
+                    url=lambda u, c: reverse('logout'),
+                    weight=200, name='LOGOUT'),
             ui.Link(
                     visibility=ui.Visibility.AUTHENTICATED,
                     text=lambda u, c: smart_unicode(u.username),
@@ -71,7 +76,10 @@ class SuperUserSwitchMenuItem(ui.UserMenuItem):
 ui.register(ui.USER_MENU,
             ui.UserMenuItem(
                 label=_("edit profile"),
-                url=lambda u, c: reverse('edit_user', kwargs={'id': c['user'].id}),
+                url=lambda u, c: reverse('edit_user', kwargs={
+                    'id': c['user'].id,
+                    'slug' : slugify(c['user'].username)
+                }),
                 span_attrs={'class': 'user-edit'},
                 weight=0,
                 name='EDIT_PROFILE'