#JC-1605 Basic functions of captcha moved to service. Added tests.