Development Blog

Production: User accounts and the first official release

Milestone Programming
As discussed in the previous update, the next step for the project was to introduce account creation and sign-in functionality. This addition will make it easier to track player progress once DynamoDB is implemented.

To achieve this, the main menu had to be completely redesigned to accommodate sign-in and sign-up options. It also needed to enforce password requirements set by AWS Cognito, ensuring users enter valid credentials during account creation.
The easiest way to ensure that passwords met the required strength criteria was to use regular expressions for each requirement, such as uppercase letters, special characters, and more.
	const FRegexPattern numberPattern(TEXT(R"(\d)")); // contain at least one number
	const FRegexPattern specialCharPattern(TEXT(R"([^\w\s])")); // contain at least one special character
	const FRegexPattern upperCasePattern(TEXT(R"([A-Z])")); // contain at least one upper case character
	const FRegexPattern lowerCasePattern(TEXT(R"([a-z])")); // contain at least one lower case character

	FRegexMatcher numberMatcher(numberPattern, password);
	FRegexMatcher specialCharMatcher(specialCharPattern, password);
	FRegexMatcher upperCaseMatcher(upperCasePattern, password);
	FRegexMatcher lowerCaseMatcher(lowerCasePattern, password);
Another example of using regex is to verify whether an email address follows the standard format: a combination of letters and numbers, followed by "@", then a domain consisting of letters and a dot (e.g., example@domain.com).
const FRegexPattern emailPattern(TEXT(R"((^[^\s@]+@[^\s@]+\.[^\s@]{2,}$))")); // string of letters and number + @ + letters + . letters
While implementing the sign-up logic, it was discovered that users could register with the same email address multiple times. To fix this issue, a Lambda function needed to be integrated differently than usual—as a pre-sign-up trigger. AWS Cognito allows for a pre-sign-up Lambda trigger, which executes before the sign-up process is completed. This made it possible to check whether the email address was already registered in Cognito's user database and prevent duplicate accounts.
This is available in Cognito/UserPool/Extensions
After finishing implementing the HTTP requests necessary, the result was as shown in the video below: