From ce2a408256dcd81690f812dee95b0797e8880824 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 11 Jul 2012 17:07:46 -0400
Subject: [PATCH] Fixed bug in ConfigUserService when user has nothing other than an account name
---
src/com/gitblit/GitBlit.java | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index eab265a..27d43c8 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -512,9 +512,15 @@
userCookie = new Cookie(Constants.NAME, "");
} else {
// set cookie for login
- char[] cookie = userService.getCookie(user);
- userCookie = new Cookie(Constants.NAME, new String(cookie));
- userCookie.setMaxAge(Integer.MAX_VALUE);
+ String cookie = userService.getCookie(user);
+ if (StringUtils.isEmpty(cookie)) {
+ // create empty cookie
+ userCookie = new Cookie(Constants.NAME, "");
+ } else {
+ // create real cookie
+ userCookie = new Cookie(Constants.NAME, cookie);
+ userCookie.setMaxAge(Integer.MAX_VALUE);
+ }
}
userCookie.setPath("/");
response.addCookie(userCookie);
--
Gitblit v1.9.1