public class GenericUserEventHandler extends com.backendless.servercode.extension.UserExtender
{
BackendlessDataQuery dataQuery;
String whereClause;
String verfied;
@Async
@Override
public void beforeLogin( RunnerContext context, String login, String password ) throws Exception
{
// add your code here
dataQuery =new BackendlessDataQuery();
whereClause = “email = '” +login+"’";
BackendlessCollection<BackendlessUser> result = Backendless.Persistence.of(BackendlessUser.class).find(dataQuery);
Iterator<BackendlessUser> iterator = result.getCurrentPage().iterator();
while (iterator.hasNext()){
BackendlessUser user = iterator.next();
verfied = user.getProperty(“verified”).toString();
}
if (verfied==“true”){
}
}
@Async
@Override
public void afterLogin( RunnerContext context, String login, String password, ExecutionResult<HashMap> result ) throws Exception
{
// add your code here
}
}
Now after that how to send an erroe if verified is false
so you mean to say that i just write
throw notverfiedexception
public class GenericUserEventHandler extends com.backendless.servercode.extension.UserExtender
{
BackendlessDataQuery dataQuery;
String whereClause;
String verfied;
@Async
@Override
public void beforeLogin( RunnerContext context, String login, String password )throws Exception
{
// add your code here
dataQuery =new BackendlessDataQuery();
whereClause = “email = '” +login+"’";
BackendlessCollection<BackendlessUser> result = Backendless.Persistence.of(BackendlessUser.class).find(dataQuery);
Iterator<BackendlessUser> iterator = result.getCurrentPage().iterator();
while (iterator.hasNext()){
BackendlessUser user = iterator.next();
verfied = user.getProperty(“verified”).toString();
}
if (verfied==“false”){
System.out.print("error");
throw new Exception("UserNotVerfied");
}
}
@Async
@Override
public void afterLogin( RunnerContext context, String login, String password, ExecutionResult<HashMap> result ) throws Exception
{
// add your code here
}
}
Now i should just run coderunner.bat and it will deploy this code on server right ?
Thank you so much i never needed help with java though i was just asking whether i should do it in that manner or not