auth: have cgit calculate login address
This way we're sure to use virtual root, or any other strangeness
encountered.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
diff --git a/ui-shared.c b/ui-shared.c
index 4f47c50..0838e18 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -73,6 +73,14 @@
return ctx.cfg.script_name;
}
+const char *cgit_loginurl()
+{
+ static const char *login_url = 0;
+ if (!login_url)
+ login_url = fmtalloc("%s?p=login", cgit_rooturl());
+ return login_url;
+}
+
char *cgit_repourl(const char *reponame)
{
if (ctx.cfg.virtual_root)