]> source.dussan.org Git - gitblit.git/commitdiff
Drop failed attempt to add user or team (issue 118)
authorJames Moger <james.moger@gitblit.com>
Mon, 6 Aug 2012 21:39:25 +0000 (17:39 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 6 Aug 2012 21:39:25 +0000 (17:39 -0400)
src/com/gitblit/ConfigUserService.java

index 959c1bca0e33f208eab5f7e30ab9e4e58a442bec..faad6915e3dfb3ed151a539ec98cb70a1d3370bb 100644 (file)
@@ -315,7 +315,10 @@ public class ConfigUserService implements IUserService {
                } catch (Throwable t) {\r
                        if (originalUser != null) {\r
                                // restore original user\r
-                               users.put(originalUser.username, originalUser);\r
+                               users.put(originalUser.username.toLowerCase(), originalUser);\r
+                       } else {\r
+                               // drop attempted add\r
+                               users.remove(model.username.toLowerCase());\r
                        }\r
                        logger.error(MessageFormat.format("Failed to update user model {0}!", model.username),\r
                                        t);\r
@@ -514,7 +517,10 @@ public class ConfigUserService implements IUserService {
                } catch (Throwable t) {\r
                        if (original != null) {\r
                                // restore original team\r
-                               teams.put(original.name, original);\r
+                               teams.put(original.name.toLowerCase(), original);\r
+                       } else {\r
+                               // drop attempted add\r
+                               teams.remove(model.name.toLowerCase());\r
                        }\r
                        logger.error(MessageFormat.format("Failed to update team model {0}!", model.name), t);\r
                }\r