Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit a15a03d

Browse files
authored
Merge pull request #127 from aws-samples/dougsch/fixUserName
Removed toUsername() as converting '@' is no longer necessary
2 parents a926c43 + 9a4db59 commit a15a03d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

WebApplication/1_StaticWebHosting/website/js/cognito-auth.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var WildRydes = window.WildRydes || {};
5959
};
6060
var attributeEmail = new AmazonCognitoIdentity.CognitoUserAttribute(dataEmail);
6161

62-
userPool.signUp(toUsername(email), password, [attributeEmail], null,
62+
userPool.signUp(email, password, [attributeEmail], null,
6363
function signUpCallback(err, result) {
6464
if (!err) {
6565
onSuccess(result);
@@ -72,7 +72,7 @@ var WildRydes = window.WildRydes || {};
7272

7373
function signin(email, password, onSuccess, onFailure) {
7474
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails({
75-
Username: toUsername(email),
75+
Username: email,
7676
Password: password
7777
});
7878

@@ -95,15 +95,11 @@ var WildRydes = window.WildRydes || {};
9595

9696
function createCognitoUser(email) {
9797
return new AmazonCognitoIdentity.CognitoUser({
98-
Username: toUsername(email),
98+
Username: email,
9999
Pool: userPool
100100
});
101101
}
102102

103-
function toUsername(email) {
104-
return email.replace('@', '-at-');
105-
}
106-
107103
/*
108104
* Event Handlers
109105
*/

0 commit comments

Comments
 (0)