about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-01-16 23:21:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2014-01-16 23:21:54 +0100
commita431326e8fab8153905fbde036dd3c9fb4cc8eaa (patch)
treeeaff3c6984a1c518c0180d5437853243ca6346a4 /ui-shared.c
parentauth: lua string comparisons are time invariant (diff)
downloadcgit-pink-a431326e8fab8153905fbde036dd3c9fb4cc8eaa.tar.gz
cgit-pink-a431326e8fab8153905fbde036dd3c9fb4cc8eaa.zip
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>
Diffstat (limited to '')
-rw-r--r--ui-shared.c8
1 files changed, 8 insertions, 0 deletions
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 @@ const char *cgit_rooturl()
 		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)