Commit 404616e0 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed creating users.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@301 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4733d984
......@@ -37,8 +37,8 @@ import java.sql.SQLException;
*/
public class DbUserInfoProvider implements UserInfoProvider {
private static final String LOAD_USER_BY_ID =
"SELECT name, email, creationDate, modificationDate FROM jiveUser WHERE username=?";
private static final String LOAD_USER_BY_USERNAME =
"SELECT name, email, creationDate, modificationDate FROM jiveUser WHERE username=?";
public UserInfo getInfo(String username) throws UserNotFoundException {
BasicUserInfo userInfo = null;
......@@ -46,7 +46,7 @@ public class DbUserInfoProvider implements UserInfoProvider {
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_USER_BY_ID);
pstmt = con.prepareStatement(LOAD_USER_BY_USERNAME);
pstmt.setString(1, username);
ResultSet rs = pstmt.executeQuery();
......
......@@ -100,10 +100,10 @@ public class UserManagerImpl extends BasicModule implements UserManager {
pstmt.setString(1, username);
pstmt.setString(2, password);
pstmt.setString(3, "");
pstmt.setString(5, email);
pstmt.setString(4, email);
Date now = new Date();
pstmt.setString(7, StringUtils.dateToMillis(now));
pstmt.setString(8, StringUtils.dateToMillis(now));
pstmt.setString(5, StringUtils.dateToMillis(now));
pstmt.setString(6, StringUtils.dateToMillis(now));
pstmt.execute();
}
catch (Exception e) {
......@@ -119,7 +119,7 @@ public class UserManagerImpl extends BasicModule implements UserManager {
}
catch (UserNotFoundException e) {
throw new UnauthorizedException("Created an account but could not load it. username: "
+ username + " pass: " + password + " email: " + email);
+ username + " pass: " + password + " email: " + email, e);
}
}
return newUser;
......@@ -132,15 +132,13 @@ public class UserManagerImpl extends BasicModule implements UserManager {
username = NodePrep.prep(username);
User user = (User)userCache.get(username);
if (user == null) {
// Hack to make sure user exists.
UserProviderFactory.getUserInfoProvider().getInfo(username);
user = loadUser(username);
}
else {
user = (User)userCache.get(username);
}
if (user == null) {
throw new UserNotFoundException();
}
return user;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment