Developed a small prototype of changeAccountPin()
This commit is contained in:
parent
6951364b9a
commit
4817c36eae
35
src/main.cpp
35
src/main.cpp
|
@ -1,18 +1,39 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include "Errorseal.h"
|
||||||
#include "AtmAdmin.h"
|
#include "AtmAdmin.h"
|
||||||
|
|
||||||
|
std::string changeAccountPin() {
|
||||||
|
std::string newPin{};
|
||||||
|
std::cout << "Enter new pin: ";
|
||||||
|
std::cin >> newPin;
|
||||||
|
Error::ignoreLine();
|
||||||
|
|
||||||
|
if (newPin.size() != 4) {
|
||||||
|
std::cout << "The pin has to be 4 digits long.\n";
|
||||||
|
std::cout << "Press enter to continue...";
|
||||||
|
std::cin.get();
|
||||||
|
return "invalid";
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPin;
|
||||||
|
}
|
||||||
|
|
||||||
bool handleUserInformation(char choice, std::string& information) {
|
bool handleUserInformation(char choice, std::string& information) {
|
||||||
|
std::string tempInformation{};
|
||||||
|
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case '1':
|
case '1':
|
||||||
// Implement a proper function for entering a new pin.
|
// Implement a proper function for entering a new pin.
|
||||||
// The function should have a somewhat complex algorithm that forces the pin to be secure, and unique.
|
// The function should have a somewhat complex algorithm that forces the pin to be secure and unique.
|
||||||
// It should also enforce 4 numbers.
|
// It should also enforce 4 numbers.
|
||||||
|
|
||||||
// Code below is a placeholder.
|
// The code below is a placeholder.
|
||||||
std::cout << "Enter new pin: ";
|
tempInformation = changeAccountPin();
|
||||||
std::cin >> information;
|
if (tempInformation != "invalid") {
|
||||||
|
information = tempInformation;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
// Implement a function for entering a new username.
|
// Implement a function for entering a new username.
|
||||||
|
@ -21,14 +42,14 @@ bool handleUserInformation(char choice, std::string& information) {
|
||||||
// This includes no spaces and no starting numbers.
|
// This includes no spaces and no starting numbers.
|
||||||
// Ensure that the name is also converted to fully lowercase.
|
// Ensure that the name is also converted to fully lowercase.
|
||||||
|
|
||||||
// Code below is a placeholder
|
// The code below is a placeholder
|
||||||
std::cout << "Enter your new username: ";
|
std::cout << "Enter your new username: ";
|
||||||
std::cin >> information;
|
std::cin >> information;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
// Simply a way to cheat, very straight-forward.
|
// Simply a way to cheat, very straight-forward.
|
||||||
|
|
||||||
// Code below is a placeholder
|
// The code below is a placeholder
|
||||||
std::cout << "Enter the amount you wish to have: ";
|
std::cout << "Enter the amount you wish to have: ";
|
||||||
std::cin >> information;
|
std::cin >> information;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user