@@ -270,17 +270,19 @@ public void needToValidateCgu(String userId, Handler<Boolean> handler) {
270
270
}
271
271
272
272
@ Override
273
- public Future <JsonObject > matchActivationCode (final String login , String potentialActivationCode ) {
274
- return matchActivationCode ("login" , login , potentialActivationCode );
273
+ public void matchActivationCode (final String login , String potentialActivationCode ,
274
+ final Handler <Either <String , JsonObject >> handler ) {
275
+ matchActivationCode ("login" , login , potentialActivationCode , handler );
275
276
}
276
277
277
278
@ Override
278
- public Future <JsonObject > matchActivationCodeByLoginAlias (final String login , String potentialActivationCode ) {
279
- return matchActivationCode ("loginAlias" , login , potentialActivationCode );
279
+ public void matchActivationCodeByLoginAlias (final String login , String potentialActivationCode ,
280
+ final Handler <Either <String , JsonObject >> handler ) {
281
+ matchActivationCode ("loginAlias" , login , potentialActivationCode , handler );
280
282
}
281
283
282
- private Future < JsonObject > matchActivationCode (final String loginFieldName , final String login , String potentialActivationCode ) {
283
- Promise < JsonObject > promise = Promise . promise ();
284
+ private void matchActivationCode (final String loginFieldName , final String login , String potentialActivationCode ,
285
+ final Handler < Either < String , JsonObject >> handler ) {
284
286
String query =
285
287
"MATCH (n:User) " +
286
288
"WHERE n." + loginFieldName + "={login} AND n.activationCode = {activationCode} AND n.password IS NULL " +
@@ -292,25 +294,26 @@ private Future<JsonObject> matchActivationCode(final String loginFieldName, fina
292
294
.put ("activationCode" , potentialActivationCode );
293
295
neo .execute (query , params , Neo4jResult .validUniqueResultHandler ( event -> {
294
296
if (event .isLeft () || !event .right ().getValue ().getBoolean ("exists" , false ))
295
- promise . fail ( "not.found" );
297
+ handler . handle ( new Either . Left < String , JsonObject >( "not.found" ) );
296
298
else
297
- promise . complete (event . right (). getValue () );
299
+ handler . handle (event );
298
300
}));
299
- return promise .future ();
300
301
}
301
302
302
303
@ Override
303
- public Future <JsonObject > matchResetCode (final String login , String potentialResetCode ) {
304
- return matchResetCode ("login" , login , potentialResetCode );
304
+ public void matchResetCode (final String login , String potentialResetCode ,
305
+ final Handler <Either <String , JsonObject >> handler ) {
306
+ matchResetCode ("login" , login , potentialResetCode , handler );
305
307
}
306
308
307
309
@ Override
308
- public Future <JsonObject > matchResetCodeByLoginAlias (final String login , String potentialResetCode ) {
309
- return matchResetCode ("loginAlias" , login , potentialResetCode );
310
+ public void matchResetCodeByLoginAlias (final String login , String potentialResetCode ,
311
+ final Handler <Either <String , JsonObject >> handler ) {
312
+ matchResetCode ("loginAlias" , login , potentialResetCode , handler );
310
313
}
311
314
312
- private Future < JsonObject > matchResetCode (final String loginFieldName , final String login , String potentialResetCode ) {
313
- Promise < JsonObject > promise = Promise . promise ();
315
+ private void matchResetCode (final String loginFieldName , final String login , String potentialResetCode ,
316
+ final Handler < Either < String , JsonObject >> handler ) {
314
317
String query =
315
318
"MATCH (n:User) " +
316
319
"WHERE n." + loginFieldName + "={login} AND has(n.resetDate) " +
@@ -321,13 +324,12 @@ private Future<JsonObject> matchResetCode(final String loginFieldName, final Str
321
324
.put ("login" , login )
322
325
.put ("resetCode" , potentialResetCode )
323
326
.put ("nowMinusDelay" , (System .currentTimeMillis () - resetCodeExpireDelay ));
324
- neo .execute (query , params , Neo4jResult .validUniqueResultHandler ( event -> {
325
- if (event .isLeft () || !event .right ().getValue ().getBoolean ("exists" , false ))
326
- promise . fail ( "not.found" );
327
- else
328
- promise . complete (event . right (). getValue () );
327
+ neo .execute (query , params , Neo4jResult .validUniqueResultHandler ( event -> {
328
+ if (event .isLeft () || !event .right ().getValue ().getBoolean ("exists" , false ))
329
+ handler . handle ( new Either . Left < String , JsonObject >( "not.found" ) );
330
+ else
331
+ handler . handle (event );
329
332
}));
330
- return promise .future ();
331
333
}
332
334
333
335
@ Override
0 commit comments