Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(auth.client): (1) extract email validation and send login otp flow to Typescript #2084

Merged
merged 11 commits into from Jun 9, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Jun 7, 2021

Problem

This PR is part 1 of migrating auth.client.js to Typescript. This PR extracts out the first two functions

  • checkIsEmailAllowed for verifying whether email domain is whitelisted, and
  • sendLoginOtp for sending the login OTP

Related to #2057

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
  • No - this PR is backwards compatible

Features:

  • add AuthService file containing the first two service functions for admin login flow
  • replace old auth.client.service.js function calls with new AuthService functions.

Tests

Unit tests have been added for the new AuthService functions.

Manual Tests

  • Login with invalid email. Should return and display not-whitelisted error message below the input
  • Login with disconnected internet (chrome console > network > offline). Should display error message below the input
  • Login with valid email. Should proceed to verify OTP page
  • Enter invalid OTP. Should reject.
  • Click resend OTP, then use previous valid OTP. Should reject. Should receive new OTP.

(Verification of OTP not tested because not in this PR)

@seaerchin
Copy link
Contributor

lgtm! cool usage of the opaque type!

@karrui karrui requested a review from tshuli June 9, 2021 02:46
@karrui karrui requested a review from mantariksh June 9, 2021 02:50
@karrui
Copy link
Contributor Author

karrui commented Jun 9, 2021

Ready for re-review

Co-authored-by: tshuli <63710093+tshuli@users.noreply.github.com>
@karrui karrui merged commit 04f5270 into develop Jun 9, 2021
@karrui karrui deleted the feat/authservice-sendloginotp-ts branch June 9, 2021 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants