use of UtilsContracts.IForgotPasswordHandler in project SmartCity-Market by TechnionYP5777.
the class ForgotPasswordTest method sendWrongAnswerWithNewPassword.
@Test
public void sendWrongAnswerWithNewPassword() {
ForgotPasswordData forgotPassData = new ForgotPasswordData(null, authQuestionAnswer + "bla");
Login ansAndPassContainer = new Login(worker.getUsername(), newPass, forgotPassData);
try {
Mockito.when(clientRequestHandler.sendRequestWithRespond(new CommandWrapper(WorkerDefs.loginCommandSenderId, CommandDescriptor.FORGOT_PASSWORD_SEND_ANSWER_WITH_NEW_PASSWORD, Serialization.serialize(ansAndPassContainer)).serialize())).thenReturn(new CommandWrapper(ResultDescriptor.SM_FOROGT_PASSWORD_WRONG_ANSWER, null).serialize());
} catch (IOException ¢) {
fail();
}
try {
((IForgotPasswordHandler) worker).sendAnswerAndNewPassword(authQuestionAnswer + "bla", newPass);
} catch (WrongAnswer e) {
//success
return;
} catch (NoSuchUserName e) {
fail();
}
fail();
}
use of UtilsContracts.IForgotPasswordHandler in project SmartCity-Market by TechnionYP5777.
the class EmployeeLoginScreen method forgetPassPressed.
@FXML
void forgetPassPressed(MouseEvent __) {
try {
IForgotPasswordHandler forgot = InjectionFactory.getInstance(Worker.class);
ForgetPasswordWizard.start(forgot);
} catch (Exception e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
//TODO
}
}
use of UtilsContracts.IForgotPasswordHandler in project SmartCity-Market by TechnionYP5777.
the class ForgotPasswordTest method sendCorrectAnswerWithNewPassword.
@Test
public void sendCorrectAnswerWithNewPassword() {
ForgotPasswordData forgotPassData = new ForgotPasswordData(null, authQuestionAnswer);
Login ansAndPassContainer = new Login(worker.getUsername(), newPass, forgotPassData);
try {
Mockito.when(clientRequestHandler.sendRequestWithRespond(new CommandWrapper(WorkerDefs.loginCommandSenderId, CommandDescriptor.FORGOT_PASSWORD_SEND_ANSWER_WITH_NEW_PASSWORD, Serialization.serialize(ansAndPassContainer)).serialize())).thenReturn(new CommandWrapper(ResultDescriptor.SM_OK, Serialization.serialize(true)).serialize());
} catch (IOException ¢) {
fail();
}
try {
((IForgotPasswordHandler) worker).sendAnswerAndNewPassword(authQuestionAnswer, newPass);
} catch (NoSuchUserName | WrongAnswer e) {
fail();
}
}
use of UtilsContracts.IForgotPasswordHandler in project SmartCity-Market by TechnionYP5777.
the class CustomerLoginScreen method forgotPassButtonPressed.
@FXML
void forgotPassButtonPressed(MouseEvent __) {
try {
IForgotPasswordHandler forgot = InjectionFactory.getInstance(Customer.class);
ForgetPasswordWizard.start(forgot);
} catch (Exception e) {
// TODO
}
}
Aggregations