Line 104 causes registration by phone to break (since it copies a phone number to an user attribute that is validate as email, invalid email error is thrown). That copy of email to attribute is already done by AWS when the login is setup to use email. Same happens to when it's set to phone_number, it's automatically replicated so that line has no use other than cause a bug.
Also the whole CognitoClient could rename email to username as it would make more sense: you can use email or phone as username. :-)
Line 104 causes registration by phone to break (since it copies a phone number to an user attribute that is validate as email, invalid email error is thrown). That copy of email to attribute is already done by AWS when the login is setup to use email. Same happens to when it's set to phone_number, it's automatically replicated so that line has no use other than cause a bug.
Also the whole CognitoClient could rename email to username as it would make more sense: you can use email or phone as username. :-)