removed more facebook stuff
This commit is contained in:
parent
c39506fe6c
commit
306ab86787
6 changed files with 4 additions and 66 deletions
|
|
@ -20,7 +20,7 @@ import zutil.db.handler.SimpleSQLResult;
|
|||
@DBTable("User")
|
||||
public class User extends DBBean{
|
||||
public enum AuthType{
|
||||
USER_INPUT, COOKIE, FACEBOOK
|
||||
USER_INPUT, COOKIE
|
||||
}
|
||||
public static final long SESSION_TIMEOUT = 1000*60*60*24*3; // 3day ttl
|
||||
|
||||
|
|
@ -113,28 +113,6 @@ public class User extends DBBean{
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses Facebook user id to get a user object,
|
||||
* this function will save the bean
|
||||
*
|
||||
* @param db is the DB connection
|
||||
* @param uid is the Facebook UID(user id)
|
||||
* @return The user object or null if non where found
|
||||
*/
|
||||
public static User loadByFacebook(HttpServletRequest request, HttpServletResponse response, DBConnection db, String uid ) throws SQLException{
|
||||
PreparedStatement sql = db.getPreparedStatement(
|
||||
"SELECT * FROM User WHERE facebookUid=? LIMIT 1");
|
||||
sql.setString(1, uid);
|
||||
|
||||
User user = DBConnection.exec(sql, DBBeanSQLResultHandler.create(User.class, db));
|
||||
if( user != null ){
|
||||
user.registerOnHost(request, response, db, false);
|
||||
user.setAuthBy( AuthType.FACEBOOK );
|
||||
user.save(db);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public static boolean emailExists(String email, DBConnection db) throws SQLException{
|
||||
PreparedStatement sql = db.getPreparedStatement(
|
||||
"SELECT email FROM User WHERE email=? LIMIT 1");
|
||||
|
|
@ -190,8 +168,6 @@ public class User extends DBBean{
|
|||
loginDate.getTime()+1000 > System.currentTimeMillis() ) &&
|
||||
ipHost.equals( request.getRemoteAddr() ) &&
|
||||
loginDate.getTime()+SESSION_TIMEOUT > System.currentTimeMillis();
|
||||
case FACEBOOK:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue