diff --git a/.github/scripts/load-version.ps1 b/.github/scripts/load-version.ps1 index b8494f7c28..4c0c51933b 100644 --- a/.github/scripts/load-version.ps1 +++ b/.github/scripts/load-version.ps1 @@ -2,4 +2,4 @@ $packageVersion = (Get-Content -Raw -Path $rootPath\src\package.json | ConvertFrom-Json).version; Write-Output "Setting package version to $packageVersion"; -Write-Output "::set-env name=PACKAGE_VERSION::$packageVersion"; +Write-Output "PACKAGE_VERSION=$packageVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append; diff --git a/.github/scripts/macos/increment-version.ps1 b/.github/scripts/macos/increment-version.ps1 index bba3d5ce3f..63787e341e 100644 --- a/.github/scripts/macos/increment-version.ps1 +++ b/.github/scripts/macos/increment-version.ps1 @@ -2,7 +2,7 @@ $packagePath = "$rootPath\package.json"; $buildNumber = 100 + [int]$env:GITHUB_RUN_NUMBER; Write-Output "Setting build number to $buildNumber"; -Write-Output "::set-env name=BUILD_NUMBER::$buildNumber"; +Write-Output "BUILD_NUMBER=$buildNumber" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append; $package = Get-Content -Raw -Path $packagePath | ConvertFrom-Json; $package.build | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$buildNumber"; $package | ConvertTo-Json -Depth 32 | Set-Content $packagePath; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3022e422c..bdc91cb20b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: node-version: '10.x' - name: Set Node options - run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" + run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV - name: Set up environment run: | @@ -126,7 +126,8 @@ jobs: node-version: '10.x' - name: Set Node options - run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" + run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + shell: pwsh - name: Set up environment if: github.event_name == 'release' @@ -232,7 +233,7 @@ jobs: node-version: '10.x' - name: Set Node options - run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" + run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV - name: Print environment run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0203956af7..068a2f5c6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,32 @@ -Code contributions are welcome! Please commit any pull requests against the `master` branch. +# How to Contribute + +Contributions of all kinds are welcome! + +Please visit our [Community Forums](https://community.bitwarden.com/) for general community discussion and the development roadmap. + +Here is how you can get involved: + +* **Request a new feature:** Go to the [Feature Requests category](https://community.bitwarden.com/c/feature-requests/) of the Community Forums. Please search existing feature requests before making a new one + +* **Write code for a new feature:** Make a new post in the [Github Contributions category](https://community.bitwarden.com/c/github-contributions/) of the Community Forums. Include a description of your proposed contribution, screeshots, and links to any relevant feature requests. This helps get feedback from the community and Bitwarden team members before you start writing code + +* **Report a bug or submit a bugfix:** Use Github issues and pull requests + +* **Write documentation:** Submit a pull request to the [Bitwarden help repository](https://github.com/bitwarden/help) + +* **Help other users:** Go to the [User-to-User Support category](https://community.bitwarden.com/c/support/) on the Community Forums + +* **Translate:** See the localization (l10n) section below + +## Contributor Agreement + +Please sign the [Contributor Agreement](https://cla-assistant.io/bitwarden/desktop) if you intend on contributing to any Github repository. Pull requests cannot be accepted and merged unless the author has signed the Contributor Agreement. + +## Pull Request Guidelines + +* use `npm run lint` and fix any linting suggestions before submitting a pull request +* commit any pull requests against the `master` branch +* include a link to your Community Forums post # Localization (l10n) diff --git a/jslib b/jslib index f30d6f8027..9aa3cbf73d 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit f30d6f8027055507abfdefd1eeb5d9aab25cc601 +Subproject commit 9aa3cbf73d9df9a2641654270911359593bcb5c5 diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts index 33b6d5ae80..d0ebe32eb6 100644 --- a/src/app/accounts/lock.component.ts +++ b/src/app/accounts/lock.component.ts @@ -1,4 +1,8 @@ -import { Component } from '@angular/core'; +import { + Component, + OnDestroy, + NgZone, +} from '@angular/core'; import { ActivatedRoute, Router, @@ -15,19 +19,24 @@ import { StorageService } from 'jslib/abstractions/storage.service'; import { UserService } from 'jslib/abstractions/user.service'; import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component'; +const BroadcasterSubscriptionId = 'LockComponent'; + @Component({ selector: 'app-lock', templateUrl: 'lock.component.html', }) -export class LockComponent extends BaseLockComponent { +export class LockComponent extends BaseLockComponent implements OnDestroy { constructor(router: Router, i18nService: I18nService, platformUtilsService: PlatformUtilsService, messagingService: MessagingService, userService: UserService, cryptoService: CryptoService, storageService: StorageService, vaultTimeoutService: VaultTimeoutService, environmentService: EnvironmentService, stateService: StateService, - apiService: ApiService, private route: ActivatedRoute) { + apiService: ApiService, private route: ActivatedRoute, + private broadcasterService: BroadcasterService, private ngZone: NgZone) { super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService, storageService, vaultTimeoutService, environmentService, stateService, apiService); } @@ -39,5 +48,23 @@ export class LockComponent extends BaseLockComponent { setTimeout(() => this.unlockBiometric(), 1000); } }); + this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { + this.ngZone.run(() => { + switch (message.command) { + case 'windowHidden': + this.onWindowHidden(); + break; + default: + } + }); + }); + } + + ngOnDestroy() { + this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); + } + + onWindowHidden() { + this.showPassword = false; } } diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts index 1b06d85b5b..d0d0ba0b13 100644 --- a/src/app/accounts/login.component.ts +++ b/src/app/accounts/login.component.ts @@ -1,6 +1,8 @@ import { Component, ComponentFactoryResolver, + OnDestroy, + NgZone, ViewChild, ViewContainerRef, } from '@angular/core'; @@ -19,14 +21,18 @@ import { StateService } from 'jslib/abstractions/state.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { SyncService } from 'jslib/abstractions/sync.service'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component'; import { ModalComponent } from 'jslib/angular/components/modal.component'; +const BroadcasterSubscriptionId = 'LoginComponent'; + @Component({ selector: 'app-login', templateUrl: 'login.component.html', }) -export class LoginComponent extends BaseLoginComponent { +export class LoginComponent extends BaseLoginComponent implements OnDestroy { @ViewChild('environment', { read: ViewContainerRef, static: true }) environmentModal: ViewContainerRef; showingModal = false; @@ -35,7 +41,8 @@ export class LoginComponent extends BaseLoginComponent { syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver, platformUtilsService: PlatformUtilsService, stateService: StateService, environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService, - cryptoFunctionService: CryptoFunctionService, storageService: StorageService) { + cryptoFunctionService: CryptoFunctionService, storageService: StorageService, + private broadcasterService: BroadcasterService, private ngZone: NgZone) { super(authService, router, platformUtilsService, i18nService, stateService, environmentService, passwordGenerationService, cryptoFunctionService, storageService); super.onSuccessfulLogin = () => { @@ -43,6 +50,24 @@ export class LoginComponent extends BaseLoginComponent { }; } + async ngOnInit() { + await super.ngOnInit(); + this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { + this.ngZone.run(() => { + switch (message.command) { + case 'windowHidden': + this.onWindowHidden(); + break; + default: + } + }); + }); + } + + ngOnDestroy() { + this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); + } + settings() { const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); const modal = this.environmentModal.createComponent(factory).instance; @@ -61,4 +86,8 @@ export class LoginComponent extends BaseLoginComponent { modal.close(); }); } + + onWindowHidden() { + this.showPassword = false; + } } diff --git a/src/app/accounts/register.component.html b/src/app/accounts/register.component.html index 6ff8d465cb..b43e4dbe47 100644 --- a/src/app/accounts/register.component.html +++ b/src/app/accounts/register.component.html @@ -41,7 +41,7 @@ {{'masterPassDesc' | i18n}} -