Skip to content

[SG-666][SG-667] Email is not prefilled and username isn't generated automatically#2109

Merged
LRNcardozoWDF merged 4 commits intomasterfrom
bug/SG-666-email-is-not-prefilled
Oct 3, 2022
Merged

[SG-666][SG-667] Email is not prefilled and username isn't generated automatically#2109
LRNcardozoWDF merged 4 commits intomasterfrom
bug/SG-666-email-is-not-prefilled

Conversation

@LRNcardozoWDF
Copy link
Member

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

With this changes email is now prefilled when selecting Plus Adressed Email username type, the username is generated automatically upon navigation and if the chosen item has an URI we pass it correctly as a field for Plus Adressed Email or Catch-all Email username types.

Code changes

  • GeneratorPageViewModel.cs: Now we fetch the user's email and generate automatically the username for all username types except UsernameType.ForwardedEmailAlias.
  • CipherAddEditPageViewModel.cs: Fixed the field sent to the generator page.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@LRNcardozoWDF LRNcardozoWDF requested a review from a team October 3, 2022 10:17
return;
}

var website = (bool)(Cipher?.Login?.HasUris) ? Cipher?.Login?.Uris[0].Host : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Cipher or Login is null then when you cast it to bool it will throw an exception, so it should be something like:

var website = (Cipher?.Login?.HasUris ?? false) ? Cipher.Login.Uris[0].Host : null;

or another even better way:

var website = Cipher?.Login?.Uris?.FirstOrDefault()?.Host;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with second suggestion, thank you for your help.

* Added missing property initialization
@LRNcardozoWDF LRNcardozoWDF requested a review from fedemkr October 3, 2022 15:29
@LRNcardozoWDF LRNcardozoWDF merged commit a890ee6 into master Oct 3, 2022
@LRNcardozoWDF LRNcardozoWDF deleted the bug/SG-666-email-is-not-prefilled branch October 3, 2022 15:51
trmartin4 pushed a commit that referenced this pull request Oct 3, 2022
…automatically (#2109)

* SG-666 SG-667 - Email is now prefilled for plus addressed email username type
* Username is auto generated upon navigation

* SG-666 - Fixed PR comments
* Added missing property initialization

(cherry picked from commit a890ee6)
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.

2 participants