Skip to content

Commit

Permalink
Merge pull request #276 from eficode/feature/fix-capital-letter-email
Browse files Browse the repository at this point in the history
fix(app-signup): make email lowercase on signup
  • Loading branch information
sofusalbertsen authored Apr 9, 2021
2 parents 4e5381c + d3c9ed0 commit 170b335
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
34 changes: 34 additions & 0 deletions packages/game-app/cypress/integration/signup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,40 @@ context('Signup', () => {
});
});

it('should signup correctly and go to email verification required if email contains capital letters', () => {
const { email, password } = generateRandomCredentials();
const emailWithCapitalLetters = email.charAt(0).toUpperCase() + email.slice(1);
usedEmails.push(email);
cy.getInputByName('firstName').fill('John');
cy.getInputByName('lastName').fill('Doe');
cy.getInputByName('email').fill(emailWithCapitalLetters);
cy.getInputByName('password').fill(password);
cy.getInputByName('repeatPassword').fill(password);
cy.getInputByName('role').select('endUser');
cy.getInputByName('devOpsMaturity').select('veryImmature');
cy.containsTranslationOf('button', 'signup.form.buttonText').click();
cy.get('body').should('contain.translationOf', 'signup.verificationRequired.title');

// check auth presence
cy.getFirebaseUserByEmail(email)
.should('deep.include', {
email: email,
emailVerified: false,
disabled: false,
})
.its('uid')
.then(uid => {
// check firestore data
cy.getFirestoreDocument(`users/${uid}`).should('contain', {
firstName:'John',
lastName:'Doe',
devOpsMaturity: 'veryImmature',
role: 'endUser',
email: email,
});
});
});

it('should show email already used error', () => {
const { email, password } = generateRandomCredentials();
cy.initializeUser({ email });
Expand Down
10 changes: 6 additions & 4 deletions packages/game-app/src/signup/sagas/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import { addRequestStatusManagement } from '@pipeline/requests-status';
import { actions as authActions, AuthUser } from '@pipeline/auth';
import { actions as analyticsActions } from '@pipeline/analytics';
import { selectors as dynamicSelectors } from '@pipeline/dynamicData';
import { SignupInfo } from '../types/signupInfo';

function* signupSaga(action: ReturnType<typeof actions.signup>) {
const user: AuthUser = yield call(executeSignup, action.payload);
const info: SignupInfo = { ...action.payload, email: action.payload.email.toLowerCase() };
const user: AuthUser = yield call(executeSignup, info);
yield put(authActions.setLoggedUser(user));
const maturities = yield select(dynamicSelectors.getDevOpsMaturitiesMap);
const roles = yield select(dynamicSelectors.getGameRolesMap);
const crmInfo = {
email: action.payload.email,
firstName: action.payload.firstName,
lastName: action.payload.lastName,
email: info.email,
firstName: info.firstName,
lastName: info.lastName,
how_mature_are_your_devops_practices_: maturities[action.payload.devOpsMaturity],
what_is_your_role_in_the_company_: roles[action.payload.role],
id: user.id,
Expand Down

0 comments on commit 170b335

Please sign in to comment.