user.countryCode = config.getString(USER, username, COUNTRYCODE);\r
user.cookie = config.getString(USER, username, COOKIE);\r
if (StringUtils.isEmpty(user.cookie) && !StringUtils.isEmpty(user.password)) {\r
- user.cookie = StringUtils.getSHA1(user.username + user.password);\r
+ user.cookie = user.createCookie();\r
}\r
\r
// preferences\r
protected void setCookie(UserModel user, char [] password) {
// create a user cookie
if (StringUtils.isEmpty(user.cookie) && !ArrayUtils.isEmpty(password)) {
- user.cookie = StringUtils.getSHA1(user.username + new String(password));
+ user.cookie = user.createCookie();
}
}
}\r
\r
// change the cookie\r
- user.cookie = StringUtils.getSHA1(user.username + password);\r
+ user.cookie = user.createCookie();\r
\r
String type = settings.get(Keys.realm.passwordStorage).getString("md5");\r
if (type.equalsIgnoreCase("md5")) {\r
String projectPath = StringUtils.getFirstPathElement(repository);\r
return !StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase(getPersonalPath());\r
}\r
+ \r
+ public String createCookie() {\r
+ return StringUtils.getSHA1(String.valueOf(Math.random()));\r
+ }\r
}\r
}\r
\r
// change the cookie\r
- userModel.cookie = StringUtils.getSHA1(userModel.username + password);\r
+ userModel.cookie = userModel.createCookie();\r
\r
// Optionally store the password MD5 digest.\r
String type = app().settings().getString(Keys.realm.passwordStorage, "md5");\r