public TemporaryKeyImpl createTemporaryKeyByEmail(String email, String ip, String action) {
TemporaryKeyImpl tk = null;
DB db = DBFactory.getInstance();
// check if the user is already registered
// we also try to find it in the temporarykey list
List tks = db.find("from org.olat.registration.TemporaryKeyImpl as r where r.emailAddress = ?", email,
Hibernate.STRING);
if ((tks == null) || (tks.size() != 1)) { // no user found, create a new one
tk = register(email, ip, action);
} else {
tk = (TemporaryKeyImpl) tks.get(0);