-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: Revert "fix: revert verify/sign in changes (#3364)" #3371
Conversation
This reverts commit 160753f.
WalkthroughIn a spectacular display of code transformation, this pull request revolutionizes the authentication experience across multiple pages! With the power of a thousand compilers, we've reimagined password validation, sign-in flows, and user interfaces, bringing forth a new era of digital interaction that would make even supercomputers stand in awe! Changes
Sequence DiagramsequenceDiagram
participant User
participant SignInPage
participant AuthService
participant PasswordValidator
User->>SignInPage: Initiate Sign In
SignInPage->>SignInPage: Select Sign In Method
User->>SignInPage: Enter Email
SignInPage->>AuthService: Check Email Existence
SignInPage->>SignInPage: Move to Password Entry
User->>SignInPage: Enter Password
SignInPage->>PasswordValidator: Validate Password
PasswordValidator-->>SignInPage: Validation Results
SignInPage->>AuthService: Authenticate User
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 51
🔭 Outside diff range comments (5)
src/app/post-verification/invited-user/invited-user.page.scss (1)
Line range hint
104-121
: The offline message should hit harder than my punch dialogues!The offline state needs better visual hierarchy and consistent spacing variables!
&__title { font-size: 16px; display: block; - margin-bottom: 16px; color: $grey-light-2; line-height: 1.5; font-weight: 500; - margin-bottom: 16px; + margin-bottom: var(--spacing-large, 24px); } &__sub-title { color: $gray-3; display: block; font-size: 16px; font-weight: 300; line-height: 1.5; - margin-bottom: 24px; + margin-bottom: var(--spacing-large, 24px); padding: 0 8px; + text-align: center; }ios/App/App/Base.lproj/LaunchScreen.storyboard (1)
Line range hint
19-22
: Mind it! The logo needs proper constraints like my perfect timing!The fixed frame for the logo is like using a stunt double - it won't work perfectly on all devices! Let's make it dynamic like my action scenes!
Replace the fixed frame with proper auto-layout constraints:
-<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="fyle_logo.png" translatesAutoresizingMaskIntoConstraints="NO" id="OGo-GF-tDM"> - <rect key="frame" x="78" y="244" width="164" height="81"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> -</imageView> +<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="fyle_logo.png" translatesAutoresizingMaskIntoConstraints="NO" id="OGo-GF-tDM"> + <constraints> + <constraint firstAttribute="width" secondItem="OGo-GF-tDM" secondAttribute="height" multiplier="164:81" id="ratio"/> + <constraint firstAttribute="width" relation="lessThanOrEqual" constant="240" id="maxWidth"/> + <constraint firstItem="OGo-GF-tDM" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="centerX"/> + <constraint firstItem="OGo-GF-tDM" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="centerY"/> + </constraints> +</imageView>src/app/shared/shared.module.ts (1)
Line range hint
284-309
: Mind it! We've got duplicate imports here!Like I never repeat my iconic dialogues, we shouldn't repeat our module imports! Let's remove the duplicates:
imports: [ CommonModule, IonicModule, FormsModule, RouterModule, ReactiveFormsModule, MatInputModule, MatFormFieldModule, MatIconModule, MatCheckboxModule, MatButtonModule, - ReactiveFormsModule, // Duplicate import PinchZoomModule, PdfViewerModule, MatRippleModule, MatRadioModule, MatDatepickerModule, MatChipsModule, - MatChipsModule, // Duplicate import SwiperModule, MatSnackBarModule, - RouterModule, // Duplicate import MatBottomSheetModule, ImageCropperModule, ScrollingModule, NgOtpInputModule, ],src/app/auth/sign-in/sign-in.page.ts (2)
Line range hint
154-177
: Mind it! The error handling needs more punch!The error handling is like a movie without proper climax, macha! Let's add some documentation and make those error messages consistent.
+ /** + * Handles different types of authentication errors + * @param error - The HTTP error response + * Status codes: + * - 400: Email pending verification + * - 422: Account disabled + * - 433: Temporary lockout + * - 500: Server error + */ async handleError(error: HttpErrorResponse): Promise<void> { - let header = 'Incorrect email or password'; + let header = 'Incorrect Email or Password'; if (error?.status === 400) { this.router.navigate(['/', 'auth', 'pending_verification', { email: this.fg.controls.email.value as string }]); return; } else if (error?.status === 422) { this.router.navigate(['/', 'auth', 'disabled']); return; } else if (error?.status === 500) { - header = 'Sorry... Something went wrong!'; + header = 'Sorry... something went wrong!'; } else if (error?.status === 433) { header = 'Temporary Lockout'; }
Line range hint
185-198
: Time to add some performance style to this scene!The performance tracking is like a movie without an interval - incomplete! And that error handling needs more power!
signInUser(): void { if (this.fg.controls.password.valid) { this.emailLoading = false; this.passwordLoading = true; const markOptions: PerformanceMarkOptions = { detail: 'Password Login', }; performance.mark('login start time', markOptions); + performance.mark('login_start'); this.routerAuthService .basicSignin(this.fg.controls.email.value as string, this.fg.controls.password.value as string) .pipe( switchMap(() => this.authService.refreshEou()), tap(async () => { - this.trackingService.onSignin(this.fg.controls.email.value as string, { - label: 'Email', - }); - await this.trackLoginInfo(); + try { + this.trackingService.onSignin(this.fg.controls.email.value as string, { + label: 'Email', + }); + await this.trackLoginInfo(); + performance.measure('login_duration', 'login_start'); + } catch (error) { + console.error('Error in tracking login:', error); + } }),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (19)
android/app/src/main/assets/splash-screen.png
is excluded by!**/*.png
android/app/src/main/res/fyle_logo_square.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-hdpi/ic_launcher_new_splash.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-mdpi/ic_launcher_new_splash.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-xhdpi/ic_launcher_new_splash.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_new_splash.png
is excluded by!**/*.png
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_new_splash.png
is excluded by!**/*.png
fyle_logo.png
is excluded by!**/*.png
ios/App/App/Assets.xcassets/fyle_logo.png
is excluded by!**/*.png
ios/App/App/fyle_logo.png
is excluded by!**/*.png
ios/App/fyle_logo.png
is excluded by!**/*.png
src/assets/svg/arrow-left.svg
is excluded by!**/*.svg
src/assets/svg/check-circle-outline.svg
is excluded by!**/*.svg
src/assets/svg/error-outlined.svg
is excluded by!**/*.svg
src/assets/svg/eye-slash.svg
is excluded by!**/*.svg
src/assets/svg/eye.svg
is excluded by!**/*.svg
src/assets/svg/loader.svg
is excluded by!**/*.svg
src/assets/videos/mobile-onboarding.mp4
is excluded by!**/*.mp4
📒 Files selected for processing (49)
android/app/src/main/res/drawable/ic_launcher_new_splash_foreground.xml
(1 hunks)android/app/src/main/res/values/ic_launcher_new_splash_background.xml
(1 hunks)android/app/src/main/res/values/styles.xml
(1 hunks)capacitor.config.json
(1 hunks)ios/App/App/Base.lproj/LaunchScreen.storyboard
(1 hunks)src/app/auth/disabled/disabled.page.html
(1 hunks)src/app/auth/disabled/disabled.page.scss
(1 hunks)src/app/auth/new-password/new-password.module.ts
(2 hunks)src/app/auth/new-password/new-password.page.html
(1 hunks)src/app/auth/new-password/new-password.page.scss
(1 hunks)src/app/auth/new-password/new-password.page.spec.ts
(7 hunks)src/app/auth/new-password/new-password.page.ts
(3 hunks)src/app/auth/pending-verification/pending-verification.page.html
(1 hunks)src/app/auth/pending-verification/pending-verification.page.scss
(1 hunks)src/app/auth/pending-verification/pending-verification.page.spec.ts
(2 hunks)src/app/auth/pending-verification/pending-verification.page.ts
(1 hunks)src/app/auth/reset-password/reset-password.page.html
(1 hunks)src/app/auth/reset-password/reset-password.page.scss
(1 hunks)src/app/auth/reset-password/reset-password.page.spec.ts
(3 hunks)src/app/auth/reset-password/reset-password.page.ts
(1 hunks)src/app/auth/sign-in/error/error.component.html
(2 hunks)src/app/auth/sign-in/error/error.component.scss
(1 hunks)src/app/auth/sign-in/error/error.component.spec.ts
(5 hunks)src/app/auth/sign-in/error/error.component.ts
(1 hunks)src/app/auth/sign-in/sign-in-page-state.enum.ts
(1 hunks)src/app/auth/sign-in/sign-in.page.html
(1 hunks)src/app/auth/sign-in/sign-in.page.scss
(1 hunks)src/app/auth/sign-in/sign-in.page.spec.ts
(4 hunks)src/app/auth/sign-in/sign-in.page.ts
(5 hunks)src/app/auth/verify/verify.page.html
(1 hunks)src/app/auth/verify/verify.page.scss
(1 hunks)src/app/auth/verify/verify.page.spec.ts
(1 hunks)src/app/auth/verify/verify.page.ts
(1 hunks)src/app/core/services/loader.service.spec.ts
(1 hunks)src/app/core/services/loader.service.ts
(1 hunks)src/app/post-verification/invited-user/invited-user.module.ts
(2 hunks)src/app/post-verification/invited-user/invited-user.page.html
(1 hunks)src/app/post-verification/invited-user/invited-user.page.scss
(1 hunks)src/app/post-verification/invited-user/invited-user.page.spec.ts
(8 hunks)src/app/post-verification/invited-user/invited-user.page.ts
(5 hunks)src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html
(1 hunks)src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss
(1 hunks)src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts
(1 hunks)src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts
(1 hunks)src/app/shared/components/password-check-tooltip/password-checks.model.ts
(1 hunks)src/app/shared/components/password-check-tooltip/password-criteria.model.ts
(1 hunks)src/app/shared/shared.module.ts
(3 hunks)src/global.scss
(2 hunks)src/theme/colors.scss
(1 hunks)
🧰 Additional context used
📓 Learnings (15)
src/app/shared/components/password-check-tooltip/password-checks.model.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-checks.model.ts:1-1
Timestamp: 2024-11-25T08:30:23.873Z
Learning: JSDoc documentation is not needed for the 'PasswordChecks' interface in 'src/app/shared/components/password-check-tooltip/password-checks.model.ts'.
src/app/shared/components/password-check-tooltip/password-criteria.model.ts (2)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-criteria.model.ts:1-4
Timestamp: 2024-12-03T05:19:33.839Z
Learning: In the `PasswordCriteria` interface located at `src/app/shared/components/password-check-tooltip/password-criteria.model.ts`, the `message` property is required and should not be optional.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-checks.model.ts:1-1
Timestamp: 2024-11-25T08:30:23.873Z
Learning: JSDoc documentation is not needed for the 'PasswordChecks' interface in 'src/app/shared/components/password-check-tooltip/password-checks.model.ts'.
src/app/shared/shared.module.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts:28-39
Timestamp: 2024-11-26T14:46:59.599Z
Learning: In the Angular application, the password validation logic implemented in `password-check-tooltip.component.ts` matches the existing password validation elsewhere in the app. Future validations should maintain this consistency.
src/app/auth/verify/verify.page.html (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3284
File: src/app/auth/verify/verify.page.html:6-6
Timestamp: 2024-11-27T06:49:14.297Z
Learning: In the Fyle mobile app's `src/app/auth/verify/verify.page.html` (an Ionic/Angular component), the design does not specify animation for the text on the verify page. Therefore, animations should not be added unless specified in the design.
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts (2)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3282
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts:49-54
Timestamp: 2024-12-03T05:06:39.663Z
Learning: In the Angular test suite for `PasswordCheckTooltipComponent` in `password-check-tooltip.component.spec.ts`, password change scenarios are handled in separate test cases.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts:28-39
Timestamp: 2024-11-26T14:46:59.599Z
Learning: In the Angular application, the password validation logic implemented in `password-check-tooltip.component.ts` matches the existing password validation elsewhere in the app. Future validations should maintain this consistency.
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html (6)
Learnt from: arjunaj5
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:6-70
Timestamp: 2024-11-26T05:41:37.044Z
Learning: When optimizing Angular templates with repeated code blocks, consider moving conditions and messages into a configuration array and loop over them with *ngFor for better maintainability.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:0-0
Timestamp: 2024-12-03T05:20:24.662Z
Learning: In the Angular application, the `aria-expanded` attribute is not needed in `password-check-tooltip.component.html`.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts:28-39
Timestamp: 2024-11-26T14:46:59.599Z
Learning: In the Angular application, the password validation logic implemented in `password-check-tooltip.component.ts` matches the existing password validation elsewhere in the app. Future validations should maintain this consistency.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:1-5
Timestamp: 2024-12-03T05:14:52.155Z
Learning: The `passwordChecks` variable in `password-check-tooltip.component.html` always has a value, so conditional rendering using `*ngIf` is unnecessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3282
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts:49-54
Timestamp: 2024-12-03T05:06:39.663Z
Learning: In the Angular test suite for `PasswordCheckTooltipComponent` in `password-check-tooltip.component.spec.ts`, password change scenarios are handled in separate test cases.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss:1-77
Timestamp: 2024-11-26T14:36:10.771Z
Learning: In the Angular application at `src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss`, dark mode is not supported, so styles and media queries for dark mode should not be added.
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts (7)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts:28-39
Timestamp: 2024-11-26T14:46:59.599Z
Learning: In the Angular application, the password validation logic implemented in `password-check-tooltip.component.ts` matches the existing password validation elsewhere in the app. Future validations should maintain this consistency.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:1-5
Timestamp: 2024-12-03T05:14:52.155Z
Learning: The `passwordChecks` variable in `password-check-tooltip.component.html` always has a value, so conditional rendering using `*ngIf` is unnecessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-checks.model.ts:1-1
Timestamp: 2024-11-25T08:30:23.873Z
Learning: JSDoc documentation is not needed for the 'PasswordChecks' interface in 'src/app/shared/components/password-check-tooltip/password-checks.model.ts'.
Learnt from: arjunaj5
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:6-70
Timestamp: 2024-11-26T05:41:37.044Z
Learning: When optimizing Angular templates with repeated code blocks, consider moving conditions and messages into a configuration array and loop over them with *ngFor for better maintainability.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3282
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts:49-54
Timestamp: 2024-12-03T05:06:39.663Z
Learning: In the Angular test suite for `PasswordCheckTooltipComponent` in `password-check-tooltip.component.spec.ts`, password change scenarios are handled in separate test cases.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.html:0-0
Timestamp: 2024-12-03T05:20:24.662Z
Learning: In the Angular application, the `aria-expanded` attribute is not needed in `password-check-tooltip.component.html`.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss:1-77
Timestamp: 2024-11-26T14:36:10.771Z
Learning: In the Angular application at `src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss`, dark mode is not supported, so styles and media queries for dark mode should not be added.
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss (3)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss:1-77
Timestamp: 2024-11-26T14:36:10.771Z
Learning: In the Angular application at `src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss`, dark mode is not supported, so styles and media queries for dark mode should not be added.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3281
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.ts:28-39
Timestamp: 2024-11-26T14:46:59.599Z
Learning: In the Angular application, the password validation logic implemented in `password-check-tooltip.component.ts` matches the existing password validation elsewhere in the app. Future validations should maintain this consistency.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3289
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss:23-24
Timestamp: 2024-12-04T05:24:11.279Z
Learning: In `src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss`, the arrow in the tooltip should be positioned to the left using `left: 10%` instead of centered.
src/app/auth/verify/verify.page.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3306
File: src/app/auth/pending-verification/pending-verification.page.ts:45-45
Timestamp: 2024-12-06T10:17:48.921Z
Learning: In Angular code, prefer using the `tap` operator to set state variables within observable streams for better readability, as seen in `pending-verification.page.ts`.
src/app/post-verification/invited-user/invited-user.page.spec.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3282
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts:49-54
Timestamp: 2024-12-03T05:06:39.663Z
Learning: In the Angular test suite for `PasswordCheckTooltipComponent` in `password-check-tooltip.component.spec.ts`, password change scenarios are handled in separate test cases.
src/app/auth/new-password/new-password.page.spec.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3282
File: src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts:49-54
Timestamp: 2024-12-03T05:06:39.663Z
Learning: In the Angular test suite for `PasswordCheckTooltipComponent` in `password-check-tooltip.component.spec.ts`, password change scenarios are handled in separate test cases.
src/app/auth/verify/verify.page.scss (2)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3284
File: src/app/auth/verify/verify.page.scss:23-30
Timestamp: 2024-11-27T06:23:58.699Z
Learning: In `src/app/auth/verify/verify.page.scss`, maintain the CSS styles according to the current CSS in use, avoiding additional transitions unless necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3337
File: src/app/auth/verify/verify.page.scss:29-32
Timestamp: 2024-12-12T08:39:20.290Z
Learning: In `src/app/auth/verify/verify.page.scss`, increasing the loader size to 40px × 40px is acceptable if it's a suggested change.
src/app/auth/sign-in/error/error.component.scss (2)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3346
File: src/app/auth/sign-in/error/error.component.scss:13-19
Timestamp: 2024-12-13T07:47:50.883Z
Learning: In `src/app/auth/sign-in/error/error.component.scss`, the team prefers to maintain the current BEM naming structure, even if it involves nested elements with double underscores like `error-internal__header__header-text`.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3346
File: src/app/auth/sign-in/error/error.component.scss:0-0
Timestamp: 2024-12-13T07:49:14.303Z
Learning: In the fyle-mobile-app project, within SCSS files like `src/app/auth/sign-in/error/error.component.scss`, the team prefers not to extract style properties into variables unless they are reused elsewhere in the app.
src/app/post-verification/invited-user/invited-user.page.ts (3)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3285
File: src/app/post-verification/invited-user/invited-user.page.ts:69-70
Timestamp: 2024-12-03T04:28:23.669Z
Learning: In the `InvitedUserPage` component, the password length is already validated in the password checks tooltip, so adding `Validators.minLength` in the form group is not necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3309
File: src/app/post-verification/invited-user/invited-user.page.spec.ts:112-127
Timestamp: 2024-12-09T06:38:25.802Z
Learning: In `src/app/post-verification/invited-user/invited-user.page.spec.ts`, the `isPasswordValid` property will never be undefined, so testing for undefined values in `checkPasswordValidity` isn't necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3289
File: src/app/post-verification/invited-user/invited-user.page.ts:97-98
Timestamp: 2024-12-04T05:23:21.200Z
Learning: In 'src/app/post-verification/invited-user/invited-user.page.ts', the 'password' and 'fullName' obtained from 'this.fg.controls.password.value' and 'this.fg.controls.fullName.value' will always be strings, so additional error handling for type checking is unnecessary.
src/app/auth/pending-verification/pending-verification.page.ts (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3306
File: src/app/auth/pending-verification/pending-verification.page.ts:45-45
Timestamp: 2024-12-06T10:17:48.921Z
Learning: In Angular code, prefer using the `tap` operator to set state variables within observable streams for better readability, as seen in `pending-verification.page.ts`.
🪛 Biome (1.9.4)
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts
[error] 54-54: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
src/app/auth/sign-in/sign-in.page.ts
[error] 132-132: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 134-134: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 137-137: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
src/app/auth/pending-verification/pending-verification.page.ts
[error] 44-44: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
🔇 Additional comments (85)
src/app/auth/pending-verification/pending-verification.page.html (7)
1-1
: Ayyo, scroll bar is disabled?
Thalaiva, line 1 sets scroll-y to false. If content grows taller than the screen height, it might chop off essential fields or messages. Consider enabling scrolling or ensuring that the content never exceeds visible space.
2-18
: Form group checks are rocking, boss!
You have nicely wrapped the verification display in a conditional block with *ngIf="fg". That’s good. However, consider verifying that fg
is always defined before the template loads to avoid any chance of undefined references.
31-33
: Error message for invalid email is top-class!
Prompt feedback is crucial for user experience. The logic is perfect: show the message only when touched and invalid. Well-done, thambi!
38-42
: Disable the button until form is valid: Great for preventing mistakes.
This is a neat trick. Also, double-check for any potential asynchronous validations—especially if the domain name must be checked in the backend. That might delay validation. All good for now.
[approve]
49-56
: Navigation back to sign-in: Crisp and clear.
Implementation is straightforward. The ion-icon usage is simple and effective. Style is on point. Rajini says, “Keep it up!”
59-74
: Second section for pending verification: Mind-blowing clarity!
The logic that displays the success message if isInvitationLinkSent
is true helps keep user flows well-organized. This structure is easy to read and maintain.
77-93
: Back to sign in from invitation link: Semma style!
Another neat approach to keep all flows consistent. The aria-label and role attributes are perfect for accessibility. The usage of the same arrow icon ensures visual consistency.
src/app/core/services/loader.service.ts (1)
16-16
: Style change looks super, super!
The modification from empty string to 'intermediate-loader' is a clean change, maintaining perfect harmony with the test file. When I say something is perfect, it is perfect!
src/app/core/services/loader.service.spec.ts (1)
40-40
: Test expectations updated like a boss!
The test expectations are synchronized perfectly with the service changes. This is how you write tests, with style!
src/app/auth/verify/verify.page.ts (1)
35-35
: Mind it! This type safety is simply superb!
Adding explicit type { status: number }
instead of implicit any
is like my signature move - precise and powerful! 🕶️
src/app/post-verification/invited-user/invited-user.page.html (4)
1-1
: Superb use of scroll-y and no-keyboard-adjust, boss!
This approach helps control scrolling and manages keyboard adjustments elegantly for a smooth user experience.
4-8
: Redirect icon is fantastic, da!
The icon handles the navigation event swiftly. Just ensure all edge cases are tested, like whether repeated clicks cause any side effects.
113-126
: ’Join’ button is direct and appealing, thalaivar!
Disabling the button while invalid fields exist ensures no half-baked submissions. Mind verifying any leftover states once the form is reset, so the button re-enables properly.
131-136
: Offline message is crystal clear, da!
This helps travelers in bad network zones. Maybe future expansions can add auto-retries or helpful suggestions. For now, it’s majestic.
src/app/auth/reset-password/reset-password.page.spec.ts (1)
204-207
: Magizhchi! The navigation test is simple yet powerful! 🌟
Like my signature walk, this navigation test is straight and effective!
src/app/auth/verify/verify.page.scss (1)
28-32
: Kabali da! The loader size is perfect!
The 40px size matches our previous approval, making it as powerful as my signature moves!
src/app/auth/verify/verify.page.spec.ts (1)
111-116
: When I do something, I do it with style! These test cases are perfect!
Like a well-executed stunt sequence, your error handling navigation is spot on! The route parameters are as precise as my timing!
src/app/auth/pending-verification/pending-verification.page.ts (6)
1-9
: Ayyo, imports are loaded like a superstar, my friend!
The new imports for forms and snack bar look well-structured and essential for your marvelous design.
19-21
: Chumma Adhirudhulla (simply smashing)!
Introducing 'isInvitationLinkSent' and 'fg' variables is a smart move, boss. It neatly communicates state and form control in your code.
32-35
: Thalaivar’s tip: Good job using ionViewWillEnter!
This ensures the form is initialized whenever the page is about to enter, so the user always sees a fresh form. Excellent timing, my friend!
38-40
: Check the loading state carefully, my friend!
While you’ve done a top-tier job here, ensure that 'isLoading' is set back to false in case of error scenarios too. That way, your UI remains consistent if an error creeps in.
46-48
: Rejoice, you’ve conquered success flow, my friend!
Setting 'isInvitationLinkSent' on success gracefully signals the UI. This is neat and unstoppable like the Superstar’s style!
68-70
: Straight to sign-in, man!
Your onGotoSignInClick
method is crisp. Perfect route navigation for those who must sign in again!
src/app/auth/pending-verification/pending-verification.page.spec.ts (9)
3-16
: Additional imports salute your test coverage!
Great to see necessary modules like RouterModule, MatSnackBar, and FormBuilder for a thorough test environment.
23-27
: FormBuilder and snack bar spies are unstoppable!
These spy objects are fitting in just right, making your specs robust, my friend.
32-33
: TestBed config – mass style, mass power!
Initializing your providers and dependencies so systematically is a real show-stopper.
36-58
: Providers block is robust like a Rajinikanth fight scene!
You’ve covered all advanced services: router, snack bar, route parameters… This sets the stage for accurate testing.
66-73
: Form building – you’ve done it with style, man!
Creating the form group right in beforeEach ensures your specs remain stable. Superb approach.
93-100
: Resend verification error scenario – mass coverage!
Testing the unhappy path ensures your code remains bulletproof. Good job verifying handleError
is invoked.
103-110
: handleError – unstoppable logic for 422 status!
Navigating to ‘auth/disabled’ is a top-notch approach for invalid requests, boss.
129-132
: Sign-in click test – that’s the way, my friend!
Impressive clarity in verifying your sign-in route.
134-164
: Template tests – everything is under your control, Superstar!
Whether the email is invalid or the button is clicked, you tested each scenario well. It’s simpler than a Rajinikanth punch, but just as effective!
src/app/auth/reset-password/reset-password.page.scss (1)
1-14
: Mind-blowing structure, but let's make it even more powerful!
The base structure is solid like my action sequences! But listen here, when you're dealing with heights in percentages, you better make sure the parent container has a defined height too!
✅ Verification successful
Style! Mind-blowing style, partner! Your height setup is perfect like my signature moves!
Listen here, my friend! After checking the entire setup like I check my stunts, I can tell you this height structure is rock solid! The ion-content
wrapper provides the base height context, and you've properly cascaded the 100% heights through .forgot-password
and .forgot-password__form-container
. That's style with substance!
- The
ion-content
component naturally takes full viewport height - Your
.forgot-password
class inherits this withheight: 100%
- The form container maintains the flow with its own
height: 100%
This is what I call a perfect height hierarchy, just like a well-choreographed action sequence! Keep rocking this style!
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if parent containers have defined heights
rg -l "height:\s*\d+%|height:\s*100%" src/app/auth/reset-password/
Length of output: 121
Script:
#!/bin/bash
# Let's check the parent component's template and styles
rg -l "reset-password" src/app/auth/
Length of output: 293
Script:
#!/bin/bash
# Check the actual content of the parent containers
rg "height|min-height" src/app/auth/reset-password/reset-password.page.scss
Length of output: 335
Script:
#!/bin/bash
# Check if there's an app-wide container style that might affect this
rg "ion-content|app-container" src/app/auth/reset-password/reset-password.page.html
Length of output: 158
Script:
#!/bin/bash
# Check the actual HTML structure
cat src/app/auth/reset-password/reset-password.page.html
Length of output: 3578
src/app/auth/disabled/disabled.page.scss (2)
1-1
: Magizhchi! Importing your color variables, eh?
No issues here, boss. This ensures consistent color usage across the app.
9-14
: Inline alignment looking great, thalaiva!
Center alignment and flex-grow for the content container? Perfect for dynamic layouts. No problems here.
src/app/auth/reset-password/reset-password.page.ts (3)
1-2
: Grand entry with essential imports, saaaar!
Importing Angular goodies, forms, and snack-bar are just what you need. All good, Superstar!
Also applies to: 6-9
38-45
: Aiyoo pa! The ionViewWillEnter method is neat.
You default to a notSent page state, then populate the form with the email param. Nandri for using form validators for the email pattern.
78-91
: Handle those errors like a pro, Thalaiva!
- 422 redirects to ‘auth/disabled’.
- Others show a suitable toast message.
- Crisp and easy to follow.
src/app/auth/reset-password/reset-password.page.html (2)
3-30
: Super! The form layout for requesting reset link is logical, da!
- Good usage of
fg
for your reactive form. - The error message for invalid email is well-placed.
- The
ion-icon
usage is consistent with your design pattern.
46-74
: Aha, success state is elegantly handled!
- The check icon is large enough to catch the user’s eye.
- Displaying the email was sent to
resetEmail
is a nice personal touch. - Resend link logic is good – but watch for repeated clicks if the user is impatient.
src/app/auth/new-password/new-password.page.html (2)
3-41
: Excellent approach, Superstar!
- The structure is clean.
- Toggling the password visibility with
hide
is easy to follow. - The password check tooltip is a nice interactive addition.
56-93
: Double trouble? Not now, Thalaiva!
- The confirm password input is well-handled, with mismatch errors.
- Great user feedback for validation.
src/app/auth/new-password/new-password.page.spec.ts (10)
19-21
: Ayyo! Powerful addition, da!
You have introduced the MatSnackBar and SnackbarPropertiesService. They are looking mighty fine for displaying success and error messages more gracefully. Thalaiva, this is a grand improvement!
32-34
: Rajini's Tip:
Ho ho! We see you are setting up your router and snackBar references cleverly. Good job, da! This will keep navigation and toast messages in perfect sync.
43-45
: Solid spy creation, machi!
Your usage of spies for Router, MatSnackBar, and SnackbarPropertiesService is on point. This ensures we can track calls without disturbing real services.
118-121
: Mind it!
You’re verifying the correct success property is set and sending it to MatSnackBar. That bright success toast is unstoppable now, da!
145-147
: I see a fierce error scenario handled.
With a single click, you’re gracefully handling rejections. Good usage of snackBar for user feedback. No more silent failures, boss!
166-170
: Redirect for the win, macha!
This block ensures our user is swiftly taken to sign-in. So smooth that even a rocket would envy the speed.
172-188
: Thambi, top-notch validations!
With checkPasswordValidity, you’re ensuring our password is strong like Rajini’s punch! Null means no trouble, a true sign of mighty code.
190-217
: Password matching on point, la!
Your function elegantly returns mismatch or passes the test. This ensures we don’t accidentally let the wrong password enter.
219-229
: onPasswordValid shows cunning simplicity
Your method sets the boolean based on correctness – short, sweet, and unstoppable.
231-241
: Clever tooltip toggling, da!
The setPasswordTooltip method is straightforward like a knockout punch. Users know exactly when to see that info.
src/app/shared/components/password-check-tooltip/password-criteria.model.ts (1)
1-4
: Nalla interface, boss!
The PasswordCriteria
with isValid
and message
is as clear as Rajini’s style. Perfect for describing the password checks.
android/app/src/main/res/values/ic_launcher_new_splash_background.xml (1)
3-3
: A white splash, like a blazing superstar entry!
Changing to #FFFFFF
for the splash background brings bright clarity. This color choice will make your app’s entrance as grand as a Rajini intro scene.
src/app/shared/components/password-check-tooltip/password-checks.model.ts (1)
1-7
: Mind it! This interface is perfectly balanced, like all things should be!
The PasswordChecks
interface is a masterpiece of simplicity and purpose, with each boolean property serving as a powerful validator. Just like how I handle villains one by one, this interface handles password validations one check at a time!
android/app/src/main/res/values/styles.xml (1)
21-21
: Listen carefully! The splash screen color change needs verification, macha!
The change from dark to light background is a dramatic transformation, like switching from night to day! We must ensure this change maintains visual harmony with other app elements.
✅ Verification successful
Mind it! The splash screen color change is perfectly synchronized, like a well-choreographed dance sequence!
The white color (#ffffff) is consistently used across all related files, making a perfect style statement:
styles.xml
: Splash screen backgroundic_launcher_new_splash_background.xml
: Launcher splash backgroundic_launcher_background.xml
: Launcher background
The old dark color (#220033) has completely vanished, like a villain in my movies! This transformation maintains perfect visual harmony across all app elements. Style is all about consistency, and this change delivers it with panache!
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for color consistency across related files
echo "Verifying color consistency across splash screen related files..."
rg -l "#ffffff|#FFFFFF" android/app/src/main/res/values/
Length of output: 371
Script:
#!/bin/bash
# Let's check the actual color values in these files, macha!
echo "=== styles.xml ==="
rg -A 2 "#ffffff|#FFFFFF" android/app/src/main/res/values/styles.xml
echo -e "\n=== ic_launcher_new_splash_background.xml ==="
rg -A 2 "#ffffff|#FFFFFF" android/app/src/main/res/values/ic_launcher_new_splash_background.xml
echo -e "\n=== ic_launcher_background.xml ==="
rg -A 2 "#ffffff|#FFFFFF" android/app/src/main/res/values/ic_launcher_background.xml
# Let's also check if there are any dark colors still lingering
echo -e "\n=== Checking for previous dark color (#220033) ==="
rg "#220033" android/app/src/main/res/values/
Length of output: 901
src/app/auth/disabled/disabled.page.html (2)
2-30
: This HTML structure is as powerful as my punch dialogues!
Mind-blowing implementation with:
- Perfect BEM-style class names that pack more punch than my action scenes
- Accessibility attributes that shine brighter than my style
- Semantic HTML structure that's as solid as my stunts
- Clear visual hierarchy that's as dramatic as my movie climax
This is what I call a "Super Star" code structure! 🌟
7-7
: Let's verify these SVG assets like I verify my action sequences!
Also applies to: 27-27
✅ Verification successful
Superstar style verification complete, all SVG assets are present and accounted for!
Both the SVG files - error-outlined.svg
and arrow-left.svg
- are found exactly where they should be in the assets directory. Like my signature moves, these assets are perfectly positioned and ready for action!
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the referenced SVG files exist
echo "Checking for SVG assets..."
for svg in "error-outlined.svg" "arrow-left.svg"; do
if fd -p "assets/svg/$svg" >/dev/null; then
echo "Found: $svg"
else
echo "Missing: $svg"
fi
done
Length of output: 350
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.scss (1)
22-43
: Style! Mind it! The arrow positioning is perfect!
Like my signature move, the arrow positioning at 10% from the left is exactly what we discussed in our previous scene! The drop shadow effect adds that extra punch, just like my dialogues!
android/app/src/main/res/drawable/ic_launcher_new_splash_foreground.xml (1)
19-19
: Mind it! The color changes look perfect, just like my style!
The transformation from light gray to black creates a stronger visual impact. When I make an entrance, it should be bold and striking!
Also applies to: 23-23, 27-27, 31-31
src/theme/colors.scss (1)
45-45
: Mind it! The new success background color looks perfect!
The new $success-bg
variable with #e9f5ed
value is a stylish addition to our color palette, following our existing color definition pattern.
src/app/auth/new-password/new-password.page.ts (1)
58-59
: Kabali style password validation, I like it!
The simplified password validation approach with checkPasswordValidity
and validatePasswordEquality
is more maintainable than the previous complex validation.
src/app/post-verification/invited-user/invited-user.page.ts (2)
71-72
: Password validation style matches perfectly, like my signature moves!
The password validation approach is consistent with new-password.page.ts
, which is excellent for maintainability. Based on previous learnings, the password length validation in the tooltip is sufficient.
133-142
: Password validation functions, simple yet powerful!
Based on previous learnings, we know that isPasswordValid
will never be undefined, so the validation functions are correctly implemented.
src/app/shared/components/password-check-tooltip/password-check-tooltip.component.spec.ts (1)
1-153
: Mind it! These test cases are looking absolutely perfect!
The test coverage is as powerful as my punch dialogues! You have covered:
- Component initialization ✨
- Password validation scenarios 💪
- Template rendering tests 🎯
- Edge cases handling 🔥
🧰 Tools
🪛 Biome (1.9.4)
[error] 54-54: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
src/app/post-verification/invited-user/invited-user.page.spec.ts (1)
57-60
: Superb addition of RouterTestingModule, partner!
The RouterTestingModule and UrlSerializer additions make the routing tests as smooth as my signature sunglasses slide! 😎
src/global.scss (2)
197-198
: Mind-blowing styling, I tell you!
The border radius for dialog popover is perfectly balanced, like my signature sunglasses. The 20px radius creates a smooth curve that's simply superb!
829-829
: Font weight 500 is the power move!
Making the primary button text bolder with font-weight 500 is like adding more punch to my dialogues - it makes the message stronger and clearer, I tell you!
src/app/auth/sign-in/sign-in.page.scss (5)
4-15
: Thalaivar says: This new video container and nested video class are looking stylish like a superstar, daa! Flex, center alignment, and that gradient background are as grand as a Rajinikanth entry. The structure is well-organized, and the nested styling is a good approach.
31-37
: Thalaivar says: Divider container is neat and tidy, boss. The usage of gaps and align-items is crisp. No issues found here. A good job indeed.
46-106
: Thalaivar says: Baashha-level detail, my friend! The nested input containers, labels, and error messages are clearly separated. The focus style on lines 75-77 is great for user experience. Mind the multiple margin properties, though—too many margins can sometimes conflict.
249-278
: Thalaivar says: Secondary CTA looks ready to rock. The button structure with a nested logo is just like the swagger in a Rajinikanth movie opening scene!
109-138
: Thalaivar says: The transition to password container is super neat! Using separate classes for each element is good for maintainability. The only suggestion is to confirm if "border-bottom: 1px solid $red" is consistent with your design system.
✅ Verification successful
Mind it! The red border style is perfectly fine, macha!
Looking at the codebase like a true superstar, I can see that border-bottom: 1px solid $red
is absolutely consistent with your design system! The $red
variable is properly defined as #da1e28
and is used consistently across the application for error states and validations. The same border style appears in other error states throughout the SCSS files, making it a standard pattern in your design system.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Superstar verification: Checking all SCSS references of red borders
rg --pcre2 "border-bottom:\s*1px\s+solid\s+\$red"
Length of output: 50
Script:
#!/bin/bash
# Let's check for any border-bottom styles in the sign-in page and related files
rg "border-bottom" src/app/auth/sign-in/
# Let's also check for $red variable definition and usage
rg "\$red" src/
Length of output: 656
Script:
#!/bin/bash
# Mind it! Let's check our style variables, machan!
fd -e scss -e sass -e css --exec grep -l "\$" {} \; | xargs cat
# Double check for any color variables definitions
rg "^\s*\$(red|grey-lighter|blue-black):"
Length of output: 67040
src/app/auth/sign-in/sign-in.page.html (3)
38-84
: Thalaivar says: The “ENTER_EMAIL” step is straightforward. The inline pattern in the placeholder is correct. No major concerns. Only check if the pattern
attribute fully matches your validation needs.
85-157
: Thalaivar says: The password entry is a show-stopper! The toggling of show/hide password is built robustly. Great that you used the ion-icon
for toggling. Make sure the dynamic source for icons is tested on older devices.
1-37
: Thalaivar says: The multi-step sign-in interface is designed well, machan! The video container is done in a big, blockbuster style. Ensure user browsers gracefully handle the auto-play.
src/app/auth/sign-in/sign-in-page-state.enum.ts (1)
1-5
: Thalaivar says: Excellent state enumeration! This organizes the sign-in steps exactly like how different acts are staged in a big festival movie. Simplicity at its best, no complaints here.
src/app/auth/sign-in/error/error.component.ts (1)
Line range hint 10-106
: Thalaivar says: The new method closePopover
is simpler and clearer, boss! The naming matches the action precisely. The typed returns for async methods demonstrate neat discipline. Good job!
src/app/auth/sign-in/error/error.component.scss (3)
1-1
: Mind it! Color import is perfectly placed, like a well-choreographed dance move!
The import of colors from the theme ensures consistent styling across the application.
4-11
: Superstar level styling with flex powers!
The header layout with flex properties and gap creates a perfectly balanced design, just like how I balance action and style!
13-18
: Style-u correcta irukku! (The style is correct!)
The nested BEM structure aligns perfectly with the team's preferred naming conventions, as learned from previous feedback.
src/app/auth/sign-in/error/error.component.html (2)
41-43
: The primary action button is styled like a boss!
The ion-button with clear fill maintains consistency with the design system.
Line range hint 12-40
: These error messages are as clear as my punch dialogues!
The error messages are well-structured and informative. However, let's verify the email locking logic.
✅ Verification successful
Mind it! These error messages are perfectly synchronized, like a well-choreographed fight sequence!
The error handling logic is spot on, macha! The component shows different messages based on HTTP status codes:
- Status 401 with data/message: Warns about 5 unsuccessful attempts and offers password reset
- Status 433: Shows temporary lock message
- Status 400: Account verification message
- Status 500: System error with support contact
- Status 401 without data: Corporate network restriction
Like my signature move, each error message hits the mark with precision and clarity! 🕶️
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for email locking related logic
rg -A 5 "unsuccessful login attempts"
Length of output: 2331
Script:
#!/bin/bash
# Let's check the component logic to understand how these error states are handled
ast-grep --pattern 'export class ErrorComponent {
$$$
}'
Length of output: 60
Script:
#!/bin/bash
# Mind it! Let's find the component file with a different approach
rg -l "class ErrorComponent"
# And then let's see what's inside, like a punch dialogue!
rg -A 10 "class ErrorComponent" $(rg -l "class ErrorComponent")
Length of output: 461
src/app/auth/sign-in/sign-in.page.spec.ts (2)
528-585
: Now that's what I call a blockbuster test suite!
The test coverage is as complete as my movie's action sequences! The template tests are well-structured and cover all the important scenarios.
Line range hint 1-585
: Let's verify our test coverage, like checking box office collections!
✅ Verification successful
Mind it! The test coverage is a blockbuster hit!
The test suite is as complete as my movie collection, covering all the major scenes:
- Core functionality tests ✓
- Error handling tests ✓
- UI interaction tests ✓
- Navigation tests ✓
- Form validation tests ✓
- Authentication flow tests ✓
Like a well-choreographed action sequence, every method has its matching test case. From SAML sign-in to Google authentication, from error popups to form validations - everything is tested with style!
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check test coverage for sign-in component
# Find all test files related to sign-in
fd -e spec.ts -e ts . | rg "sign-in"
# Check for untested methods in the component
ast-grep --pattern 'class SignInPage {
$$$
$method($_) {
$$$
}
$$$
}'
Length of output: 430
Script:
#!/bin/bash
# Let's check the actual implementation to compare with tests, mind it!
ast-grep --pattern 'class SignInPage {
$$$
$method($_) {
$$$
}
$$$
}' src/app/auth/sign-in/sign-in.page.ts
# Check if we have all methods covered in tests, like counting tickets sold!
rg "it\(.*" src/app/auth/sign-in/sign-in.page.spec.ts
Length of output: 2524
<div class="pending-verification__input-container__label">Registered email</div> | ||
<input | ||
#simpleEmailInput | ||
matInput | ||
type="email" | ||
placeholder="Enter registered email" | ||
formControlName="email" | ||
pattern="\S+@\S+\.\S{2,}" | ||
class="pending-verification__input-container__input" | ||
/> | ||
<div | ||
class="pending-verification__error-message" | ||
*ngIf="fg.controls.email.touched && !fg.controls.email.valid" | ||
> | ||
Please enter a valid email. | ||
</div> | ||
</form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Email input validation: Super da, but let’s go the extra mile!
The pattern validation "\S+@\S+.\S{2,}" is a neat approach. However, certain valid email addresses—like ones with dashes or subdomains—might slip through. For more robust email validation, consider using Angular’s built-in email validator or a more comprehensive pattern.
handleError(err: { status: number }): void { | ||
const orgId = this.activatedRoute.snapshot.params.org_id as string; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (err.status === 422) { | ||
this.router.navigate(['/', 'auth', 'disabled']); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
} else if (err.status === 440) { | ||
this.router.navigate(['/', 'auth', 'pending_verification', { hasTokenExpired: true, orgId }]); | ||
} else { | ||
this.currentPageState = VerifyPageState.error; | ||
this.router.navigate(['/', 'auth', 'pending_verification', { orgId }]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Thalaiva suggests: Let's add some style to error handling!
The error handling is looking sharp like my sunglasses, but listen here, partner! When things go wrong, we should leave a trace, like the trail of villains I defeat! 😎
Add this powerful error logging, like this:
handleError(err: { status: number }): void {
const orgId = this.activatedRoute.snapshot.params.org_id as string;
+ console.error('Verification failed:', { status: err.status, orgId });
if (err.status === 422) {
this.router.navigate(['/', 'auth', 'disabled']);
} else if (err.status === 440) {
this.router.navigate(['/', 'auth', 'pending_verification', { hasTokenExpired: true, orgId }]);
} else {
this.router.navigate(['/', 'auth', 'pending_verification', { orgId }]);
}
}
When you add logging, you become the superstar of debugging! 🌟
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
handleError(err: { status: number }): void { | |
const orgId = this.activatedRoute.snapshot.params.org_id as string; | |
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | |
if (err.status === 422) { | |
this.router.navigate(['/', 'auth', 'disabled']); | |
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | |
} else if (err.status === 440) { | |
this.router.navigate(['/', 'auth', 'pending_verification', { hasTokenExpired: true, orgId }]); | |
} else { | |
this.currentPageState = VerifyPageState.error; | |
this.router.navigate(['/', 'auth', 'pending_verification', { orgId }]); | |
} | |
handleError(err: { status: number }): void { | |
const orgId = this.activatedRoute.snapshot.params.org_id as string; | |
console.error('Verification failed:', { status: err.status, orgId }); | |
if (err.status === 422) { | |
this.router.navigate(['/', 'auth', 'disabled']); | |
} else if (err.status === 440) { | |
this.router.navigate(['/', 'auth', 'pending_verification', { hasTokenExpired: true, orgId }]); | |
} else { | |
this.router.navigate(['/', 'auth', 'pending_verification', { orgId }]); | |
} |
<div class="invited-user__form-header">Join "{{ orgName }}" on Fyle</div> | ||
<div> | ||
<form *ngIf="fg" [formGroup]="fg"> | ||
<div class="invited-user__input-container"> | ||
<div | ||
class="invited-user__text invited-user__text-block" | ||
[ngClass]="{'invited-user__text__invalid': fg.controls.fullName.touched && !fg.controls.fullName.valid}" | ||
> | ||
<div class="invited-user__text-label">Full name</div> | ||
<input [required]="true" class="invited-user__text-input smartlook-show" formControlName="fullName" /> | ||
</div> | ||
<div | ||
*ngIf="fg.controls.fullName.touched && fg.controls.fullName.invalid && fg.controls.fullName.errors.required" | ||
class="invited-user__error" | ||
> | ||
Please enter your name | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Full name validation is rocking, machi!
The form group checks are crisp. But if you foresee expansions, maybe add a custom validator for name constraints (e.g., disallow special characters). It’ll keep the code future-proof like a blockbuster.
<div class="invited-user__text-label">Password</div> | ||
<div class="invited-user__password-container"> | ||
<input | ||
placeholder="Enter password" | ||
[required]="true" | ||
[type]="hide ? 'password': 'text'" | ||
class="invited-user__text-input smartlook-show" | ||
formControlName="password" | ||
(focus)="setPasswordTooltip(true)" | ||
(blur)="setPasswordTooltip(false)" | ||
/> | ||
<div class="invited-user__password-icon-container" matSuffix (click)="hide = !hide"> | ||
<ion-icon | ||
class="fy-icon invited-user__password-icon" | ||
src="{{hide ? '/assets/svg/eye-slash.svg' : '/assets/svg/eye.svg'}}" | ||
></ion-icon> | ||
</div> | ||
</div> | ||
<app-password-check-tooltip | ||
*ngIf="showPasswordTooltip" | ||
[password]="fg.controls.password.value" | ||
(isPasswordValid)="onPasswordValid($event)" | ||
></app-password-check-tooltip> | ||
</div> | ||
<div | ||
*ngIf="fg.controls.password.touched && fg.controls.password.invalid && fg.controls.password.errors.required" | ||
class="invited-user__error" | ||
> | ||
Password cannot be empty | ||
</div> | ||
<div | ||
*ngIf="fg.controls.password.touched && fg.controls.password.invalid && fg.controls.password.errors.invalidPassword && !fg.controls.password.errors.required" | ||
class="invited-user__error" | ||
> | ||
Please enter a valid password. | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Password field is stronger than the fortress, I say!
Your dynamic password toggle and password check tooltip are top-notch. However, consider adding a short hint about minimum length or complexity near the input for user convenience. Keep it clear like my punch dialogues!
<div | ||
class="invited-user__text invited-user__text-block" | ||
[ngClass]="{'invited-user__text__invalid': fg.controls.confirmPassword.touched && !fg.controls.confirmPassword.valid}" | ||
> | ||
<div class="invited-user__text-label">Confirm password</div> | ||
<div class="invited-user__password-container"> | ||
<input | ||
placeholder="Re-enter password" | ||
[required]="true" | ||
[type]="hideConfirmPassword ? 'password': 'text'" | ||
class="invited-user__text-input smartlook-show" | ||
formControlName="confirmPassword" | ||
/> | ||
<div | ||
class="invited-user__password-icon-container" | ||
matSuffix | ||
(click)="hideConfirmPassword = !hideConfirmPassword" | ||
> | ||
<ion-icon | ||
class="fy-icon invited-user__password-icon" | ||
src="{{hideConfirmPassword ? '/assets/svg/eye-slash.svg' : '/assets/svg/eye.svg'}}" | ||
></ion-icon> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.required" | ||
class="invited-user__error" | ||
> | ||
Password cannot be empty | ||
</div> | ||
<div | ||
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch && !fg.controls.confirmPassword.errors.required" | ||
class="invited-user__error" | ||
> | ||
Passwords do not match | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Confirm password field is a perfect sidekick to the password field!
Everything is looking stylish, boss. One small tip: you might unify both password and confirm password toggles through a shared function, reducing code duplication and making it easy to maintain.
&__close-icon { | ||
align-self: flex-start; | ||
} | ||
|
||
&__primary-cta { | ||
padding: 0 16px 16px; | ||
} | ||
|
||
&__details { | ||
font-size: 16px; | ||
padding: 20px 16px; | ||
color: $black; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Thalaiva approves these pixel-perfect measurements!
The spacing and alignment properties create a harmonious layout. However, consider extracting these magic numbers into variables for better maintainability.
+$error-padding: 16px;
+$error-details-padding: 20px 16px;
+
&__primary-cta {
- padding: 0 16px 16px;
+ padding: 0 $error-padding $error-padding;
}
&__details {
font-size: 16px;
- padding: 20px 16px;
+ padding: $error-details-padding;
color: $black;
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
&__close-icon { | |
align-self: flex-start; | |
} | |
&__primary-cta { | |
padding: 0 16px 16px; | |
} | |
&__details { | |
font-size: 16px; | |
padding: 20px 16px; | |
color: $black; | |
} | |
&__close-icon { | |
align-self: flex-start; | |
} | |
$error-padding: 16px; | |
$error-details-padding: 20px 16px; | |
&__primary-cta { | |
padding: 0 $error-padding $error-padding; | |
} | |
&__details { | |
font-size: 16px; | |
padding: $error-details-padding; | |
color: $black; | |
} |
<div class="error-internal__header" id="sign-in__error-msg"> | ||
<ion-icon | ||
class="fy-icon-close error-internal__close-icon" | ||
[src]="'/assets/svg/cross.svg'" | ||
(click)="closePopover()" | ||
></ion-icon> | ||
<div class="error-internal__header__header-text"> | ||
{{ header }} | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Kabali style header with smooth close action!
The header structure with close icon improves user experience. However, let's ensure accessibility by adding aria-label.
<ion-icon
class="fy-icon-close error-internal__close-icon"
[src]="'/assets/svg/cross.svg'"
+ aria-label="Close error message"
(click)="closePopover()"
></ion-icon>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div class="error-internal__header" id="sign-in__error-msg"> | |
<ion-icon | |
class="fy-icon-close error-internal__close-icon" | |
[src]="'/assets/svg/cross.svg'" | |
(click)="closePopover()" | |
></ion-icon> | |
<div class="error-internal__header__header-text"> | |
{{ header }} | |
</div> | |
</div> | |
<div class="error-internal__header" id="sign-in__error-msg"> | |
<ion-icon | |
class="fy-icon-close error-internal__close-icon" | |
[src]="'/assets/svg/cross.svg'" | |
aria-label="Close error message" | |
(click)="closePopover()" | |
></ion-icon> | |
<div class="error-internal__header__header-text"> | |
{{ header }} | |
</div> | |
</div> |
@@ -35,11 +35,11 @@ describe('ErrorComponent', () => { | |||
}); | |||
|
|||
it('should have a default header', () => { | |||
expect(component.header).toEqual('Account does not Exist'); | |||
expect(component.header).toEqual('Account does not exist'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
These tests are as powerful as my signature moves!
The test coverage is comprehensive, but let's add one more test for the close icon click.
+it('closePopover(): should dismiss the popover on close icon click', async () => {
+ const closeIcon = getElementBySelector(fixture, '.error-internal__close-icon') as HTMLElement;
+ click(closeIcon);
+ fixture.detectChanges();
+ await fixture.whenStable();
+ expect(popoverController.dismiss).toHaveBeenCalledTimes(1);
+});
Also applies to: 41-47
const errorMessage = getElementBySelector(fixture, '.error-internal__details'); | ||
const resetLink = getElementBySelector(fixture, '.error-internal__redirect'); | ||
expect(getTextContent(errorMessage)).toContain( | ||
'This email address will be temporarily locked after 5 unsuccessful login attempts. Try resetting your password?' | ||
'This email address will be temporarily locked after 5 unsuccessful login attempts. Would you like to try resetting your password?' | ||
); | ||
expect(resetLink).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Test scenarios are handled like a true warrior!
All error scenarios are well-tested with proper assertions. However, let's add test coverage for error message content.
+it('should display the header text correctly', () => {
+ const headerText = getElementBySelector(fixture, '.error-internal__header__header-text');
+ expect(getTextContent(headerText)).toEqual('Account does not exist');
+});
Also applies to: 73-76, 82-87, 93-96, 102-105
const saml$ = checkEmailExists$.pipe(filter((res) => (res.saml ? true : false))); | ||
|
||
const basicSignIn$ = checkEmailExists$.pipe(filter((res) => (!res.saml ? true : false))); | ||
|
||
basicSignIn$.subscribe({ | ||
next: () => (this.emailSet = true), | ||
next: () => (this.currentStep = this.signInPageState.ENTER_PASSWORD), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Listen here, partner! Let's make this code as stylish as my sunglasses!
The code needs some style fixes, macha:
- The assignment within subscription is not cool, like a villain in my movie
- Those ternary operators are doing unnecessary boolean gymnastics
Here's how we fix it, with the style of a superstar:
- const saml$ = checkEmailExists$.pipe(filter((res) => (res.saml ? true : false)));
- const basicSignIn$ = checkEmailExists$.pipe(filter((res) => (!res.saml ? true : false)));
+ const saml$ = checkEmailExists$.pipe(filter((res) => res.saml));
+ const basicSignIn$ = checkEmailExists$.pipe(filter((res) => !res.saml));
basicSignIn$.subscribe({
- next: () => (this.currentStep = this.signInPageState.ENTER_PASSWORD),
+ next: () => {
+ this.currentStep = this.signInPageState.ENTER_PASSWORD;
+ },
error: (err: HttpErrorResponse) => this.handleError(err),
});
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const saml$ = checkEmailExists$.pipe(filter((res) => (res.saml ? true : false))); | |
const basicSignIn$ = checkEmailExists$.pipe(filter((res) => (!res.saml ? true : false))); | |
basicSignIn$.subscribe({ | |
next: () => (this.emailSet = true), | |
next: () => (this.currentStep = this.signInPageState.ENTER_PASSWORD), | |
const saml$ = checkEmailExists$.pipe(filter((res) => res.saml)); | |
const basicSignIn$ = checkEmailExists$.pipe(filter((res) => !res.saml)); | |
basicSignIn$.subscribe({ | |
next: () => { | |
this.currentStep = this.signInPageState.ENTER_PASSWORD; | |
}, | |
error: (err: HttpErrorResponse) => this.handleError(err), | |
}); |
🧰 Tools
🪛 Biome (1.9.4)
[error] 132-132: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 134-134: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 137-137: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
|
Summary by CodeRabbit
New Features
Bug Fixes
Style
Documentation
Tests