-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Simplelogin alias generation only generate random words instead the domain name #13024
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export abstract class CipherFormUriService { | ||
/** | ||
* The current URI value | ||
*/ | ||
abstract uri: string; | ||
|
||
/** | ||
* Updates the current URI | ||
*/ | ||
abstract setUri(uri: string): void; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// FIXME: Update this file to be type safe and remove this and next line | ||
// @ts-strict-ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// eslint-disable-next-line import/no-restricted-paths | ||
import { Injectable } from "@angular/core"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. โ The lint is correct. |
||
|
||
import { CipherFormUriService as CipherFormUriServiceAbstraction } from "../abstractions/cipher-form-uri.service"; | ||
|
||
@Injectable({ | ||
providedIn: "root", | ||
}) | ||
export class CipherFormUriService implements CipherFormUriServiceAbstraction { | ||
private _uri: string = ""; | ||
|
||
constructor() {} | ||
|
||
/** | ||
* Getter for the current URI | ||
*/ | ||
get uri(): string { | ||
return this._uri; | ||
} | ||
|
||
/** | ||
* Setter for the URI | ||
* @param uri - The new URI to set | ||
*/ | ||
setUri(uri: string): void { | ||
this._uri = uri; | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐ This change also needs to be applied to |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic | |
import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; | ||
import { IntegrationId } from "@bitwarden/common/tools/integration"; | ||
import { UserId } from "@bitwarden/common/types/guid"; | ||
import { CipherFormUriService } from "@bitwarden/common/vault/services/cipher-form-uri.service"; | ||
import { ToastService, Option } from "@bitwarden/components"; | ||
import { | ||
AlgorithmInfo, | ||
|
@@ -66,6 +67,7 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy { | |
private accountService: AccountService, | ||
private zone: NgZone, | ||
private formBuilder: FormBuilder, | ||
private cipherFormUriService: CipherFormUriService, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. โ This couples the username generator to the vault. At present, the vault is the only consumer, but it's not the only one. Rewrite this to use an attribute. |
||
) {} | ||
|
||
/** Binds the component to a specific user's settings. When this input is not provided, | ||
|
@@ -336,7 +338,11 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy { | |
|
||
private typeToGenerator$(type: CredentialAlgorithm) { | ||
const dependencies = { | ||
on$: this.generate$, | ||
on$: this.generate$.pipe( | ||
map(() => ({ | ||
website: this.cipherFormUriService.uri, | ||
})), | ||
), | ||
userId$: this.userId$, | ||
}; | ||
|
||
|
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.
๐ค Was this change requested by the vault team? The solution analysis indicates the website should be passed using an attribute on the component, not a new service.
If the vault team did ask for this service to be created, then it should be integrated within their component, not the shared tools component.