Fully implemented name & PIN change

This commit is contained in:
theskywinds 2025-06-18 09:22:48 +02:00
parent 9a4597511c
commit dba3851aca

View File

@ -34,7 +34,7 @@ namespace AtmAdmin {
// It also saves and applies the information if the user accepts it.
void confirmUserInformation (XMLStorage& mainStorage, const std::string& tempInformation, const Choice choice) {
char userCheck;
bool loopDone = true;
bool loopDone{true};
do {
if (choice == PIN)
@ -201,23 +201,16 @@ namespace AtmAdmin {
// CONSTRAINTS FOR FIRST NAME
if (firstName.empty()) {
errorReport("First name cannot be empty.");
return ("invalid");
}
// Checks for letters that aren't alphabetical.
if (std::ranges::any_of(firstName.cbegin(), firstName.cend(), [] (unsigned char input) {
return !std::isalpha(input) and !std::isspace(input);
return !std::isalpha(input);
})) {
errorReport("Name cannot contain non-alphabetic letters.");
errorReport("Name cannot contain non-alphabetic letters or spaces.");
return ("invalid");
}
// Checks for any spaces in the first name.
if (std::ranges::any_of(firstName.cbegin(), firstName.cend(), [] (char input) {
return input == ' ';
})) {
errorReport("First & last name cannot contain spaces.");
return "invalid";
}
// ENDING CONSTRAINTS FOR FIRST NAME
std::cout << "Enter your last name(s): ";