use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class PINStepAction method verifyUserInput.
/**
* Verify the input of the user (e.g. no empty mandatory fields, pin length, allowed charset).
*
* @param executionResults The results containing the OutputInfoUnits of interest.
* @return True if the input of the user could be verified, else false.
*/
private boolean verifyUserInput(ExecutionResults executionResults) {
// TODO: check pin length and possibly allowed charset with CardInfo file
PasswordField fieldOldPIN = (PasswordField) executionResults.getResult(ChangePINStep.OLD_PIN_FIELD);
PasswordField fieldNewPIN = (PasswordField) executionResults.getResult(ChangePINStep.NEW_PIN_FIELD);
PasswordField fieldNewPINRepeat = (PasswordField) executionResults.getResult(ChangePINStep.NEW_PIN_REPEAT_FIELD);
oldPIN = new String(fieldOldPIN.getValue());
if (oldPIN.isEmpty()) {
return false;
}
if (new String(fieldNewPIN.getValue()).isEmpty()) {
return false;
} else {
try {
newPIN = new String(fieldNewPIN.getValue()).getBytes(ISO_8859_1);
} catch (UnsupportedEncodingException e) {
return false;
}
}
if (new String(fieldNewPINRepeat.getValue()).isEmpty()) {
return false;
} else {
try {
newPINRepeat = new String(fieldNewPINRepeat.getValue()).getBytes(ISO_8859_1);
} catch (UnsupportedEncodingException e) {
return false;
}
}
return ByteUtils.compare(newPIN, newPINRepeat);
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class PUKStepAction method verifyUserInput.
/**
* Verify the input of the user (e.g. no empty mandatory fields, pin length, allowed charset).
*
* @param executionResults The results containing the OutputInfoUnits of interest.
* @return True if the input of the user could be verified, else false
*/
private boolean verifyUserInput(ExecutionResults executionResults) {
// TODO: check pin length and possibly allowed charset with CardInfo file
PasswordField pukField = (PasswordField) executionResults.getResult(UnblockPINDialog.PUK_FIELD);
puk = new String(pukField.getValue());
return !puk.isEmpty();
}
Aggregations