Commit 4a783c5480c4f083e32b1ada28d6f730618adb90

Thomas de Grivel 2021-11-25T07:53:45

auth

diff --git a/lib/kmxgit/repository_manager/repository.ex b/lib/kmxgit/repository_manager/repository.ex
index fe2669c..5a765e2 100644
--- a/lib/kmxgit/repository_manager/repository.ex
+++ b/lib/kmxgit/repository_manager/repository.ex
@@ -19,7 +19,7 @@ defmodule Kmxgit.RepositoryManager.Repository do
     repository
     |> cast(attrs, [:description, :slug])
     |> validate_required([:slug])
-    |> validate_format(:slug, ~r|^[A-Za-z][-_+.0-9A-Za-z]{1,64}(/[A-Za-z][-_+.0-9A-Za-z]{1,64})*$|)
+    |> validate_format(:slug, ~r|^[A-Za-z][-_+.@0-9A-Za-z]{0,64}(/[A-Za-z][-_+.@0-9A-Za-z]{0,64})*$|)
     |> unique_constraint(:slug, name: "repositories__lower_slug_index")
     |> Markdown.validate_markdown(:description)
   end
diff --git a/lib/kmxgit_web/router.ex b/lib/kmxgit_web/router.ex
index 5f147f8..861adc1 100644
--- a/lib/kmxgit_web/router.ex
+++ b/lib/kmxgit_web/router.ex
@@ -33,11 +33,11 @@ defmodule KmxgitWeb.Router do
   scope "/", KmxgitWeb do
     pipe_through [:browser, :auth]
 
-    get  "/",           PageController, :index
-    get  "/_auth",      PageController, :auth
-    get  "/_keys",      PageController, :keys
-    get  "/_new_admin", PageController, :new_admin
-    post "/_new_admin", PageController, :new_admin_post
+    get  "/",                     PageController, :index
+    get  "/_etc/auth.conf",       PageController, :auth
+    get  "/_etc/authorized_keys", PageController, :keys
+    get  "/_new_admin",           PageController, :new_admin
+    post "/_new_admin",           PageController, :new_admin_post
 
     scope "/_sessions" do
       get  "/new",    SessionController, :new
diff --git a/lib/kmxgit_web/templates/user/show.html.heex b/lib/kmxgit_web/templates/user/show.html.heex
index bdc8ba7..38bb2d7 100644
--- a/lib/kmxgit_web/templates/user/show.html.heex
+++ b/lib/kmxgit_web/templates/user/show.html.heex
@@ -18,7 +18,7 @@
       <hr/>
       <h2><%= gettext "Repositories" %></h2>
       <ul>
-        <%= for repo <- @user.owned_repositories do %>
+        <%= for repo <- Enum.sort_by(@user.owned_repositories, &Repository.full_slug/1) do %>
           <li>
             <%= link Repository.full_slug(repo), to: Routes.repository_path(@conn, :show, @user.slug.slug, Repository.splat(repo)) %>
           </li>
@@ -56,14 +56,20 @@
         <tr>
           <th>
             <%= gettext "Organisations" %>
-          </th>
-          <td>
-            <%= for org <- @user.organisations do %>
-              <%= link(org.name || org.slug.slug, to: Routes.slug_path(@conn, :show, org.slug.slug), class: "org") %>
-            <% end %>
             <%= if @user == @current_user do %>
               <%= link("+", to: Routes.organisation_path(@conn, :new), class: "btn btn-primary btn-sm") %>
             <% end %>
+          </th>
+          <td>
+            <ul>
+              <%= for org <- Enum.sort_by(@user.organisations, fn o -> o.slug.slug end) do %>
+                <li>
+                  <%= link(org.name || org.slug.slug,
+                      to: Routes.slug_path(@conn, :show, org.slug.slug),
+                      class: "org") %>
+                </li>
+              <% end %>
+            </ul>
           </td>
         </tr>
         <tr>