Disable disconnecting if no password is set, show warning
This commit is contained in:
parent
a02193184d
commit
26a2e741dd
@ -502,7 +502,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">81</context>
|
<context context-type="linenumber">92</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/document-detail/document-detail.component.html</context>
|
<context context-type="sourcefile">src/app/components/document-detail/document-detail.component.html</context>
|
||||||
@ -1938,7 +1938,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">157</context>
|
<context context-type="linenumber">159</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="2753185112875184719" datatype="html">
|
<trans-unit id="2753185112875184719" datatype="html">
|
||||||
@ -2523,7 +2523,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">80</context>
|
<context context-type="linenumber">91</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/select-dialog/select-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/select-dialog/select-dialog.component.html</context>
|
||||||
@ -4110,74 +4110,81 @@
|
|||||||
<context context-type="linenumber">54</context>
|
<context context-type="linenumber">54</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="8383227756109993898" datatype="html">
|
||||||
|
<source>Set a password before disconnecting social account.</source>
|
||||||
|
<context-group purpose="location">
|
||||||
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
|
<context context-type="linenumber">58</context>
|
||||||
|
</context-group>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="5322995394400578831" datatype="html">
|
<trans-unit id="5322995394400578831" datatype="html">
|
||||||
<source>Disconnect <x id="INTERPOLATION" equiv-text="{{ account.name }}"/> social account</source>
|
<source>Disconnect <x id="INTERPOLATION" equiv-text="{{ account.name }}"/> social account</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">57</context>
|
<context context-type="linenumber">68</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="2907016025519254862" datatype="html">
|
<trans-unit id="2907016025519254862" datatype="html">
|
||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">58</context>
|
<context context-type="linenumber">69</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="649824314893051979" datatype="html">
|
<trans-unit id="649824314893051979" datatype="html">
|
||||||
<source>Warning: disconnecting social accounts cannot be undone</source>
|
<source>Warning: disconnecting social accounts cannot be undone</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">63</context>
|
<context context-type="linenumber">74</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="1375396510511350122" datatype="html">
|
<trans-unit id="1375396510511350122" datatype="html">
|
||||||
<source>Connect new social account</source>
|
<source>Connect new social account</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html</context>
|
||||||
<context context-type="linenumber">68</context>
|
<context context-type="linenumber">79</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6141884091799403188" datatype="html">
|
<trans-unit id="6141884091799403188" datatype="html">
|
||||||
<source>Emails must match</source>
|
<source>Emails must match</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">106</context>
|
<context context-type="linenumber">108</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="5281933990298241826" datatype="html">
|
<trans-unit id="5281933990298241826" datatype="html">
|
||||||
<source>Passwords must match</source>
|
<source>Passwords must match</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">134</context>
|
<context context-type="linenumber">136</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="4219429959475101385" datatype="html">
|
<trans-unit id="4219429959475101385" datatype="html">
|
||||||
<source>Profile updated successfully</source>
|
<source>Profile updated successfully</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">154</context>
|
<context context-type="linenumber">156</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="3417726855410304962" datatype="html">
|
<trans-unit id="3417726855410304962" datatype="html">
|
||||||
<source>Error saving profile</source>
|
<source>Error saving profile</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">166</context>
|
<context context-type="linenumber">168</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="154249228726292516" datatype="html">
|
<trans-unit id="154249228726292516" datatype="html">
|
||||||
<source>Error generating auth token</source>
|
<source>Error generating auth token</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">183</context>
|
<context context-type="linenumber">185</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="4153637646944982460" datatype="html">
|
<trans-unit id="4153637646944982460" datatype="html">
|
||||||
<source>Error disconnecting social account</source>
|
<source>Error disconnecting social account</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
<context context-type="sourcefile">src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.ts</context>
|
||||||
<context context-type="linenumber">208</context>
|
<context context-type="linenumber">210</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="3797570084942068182" datatype="html">
|
<trans-unit id="3797570084942068182" datatype="html">
|
||||||
|
@ -54,7 +54,18 @@
|
|||||||
<p i18n>Connected social accounts</p>
|
<p i18n>Connected social accounts</p>
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@for (account of socialAccounts; track account.id) {
|
@for (account of socialAccounts; track account.id) {
|
||||||
<li class="list-group-item">{{account.name}} ({{account.provider}})<button type="button" class="btn btn-outline-danger btn-sm ms-2 align-baseline" (click)="disconnectSocialAccount(account.id)" i18n-title title="Disconnect {{ account.name }} social account">
|
<li class="list-group-item"
|
||||||
|
ngbPopover="Set a password before disconnecting social account."
|
||||||
|
i18n-ngbPopover
|
||||||
|
[disablePopover]="hasUsablePassword"
|
||||||
|
triggers="mouseenter:mouseleave">
|
||||||
|
{{account.name}} ({{account.provider}})
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-outline-danger btn-sm ms-2 align-baseline"
|
||||||
|
[disabled]="!hasUsablePassword"
|
||||||
|
(click)="disconnectSocialAccount(account.id)"
|
||||||
|
i18n-title title="Disconnect {{ account.name }} social account">
|
||||||
<ng-container i18n>Disconnect</ng-container> <i-bs name="trash"></i-bs>
|
<ng-container i18n>Disconnect</ng-container> <i-bs name="trash"></i-bs>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
NgbModalModule,
|
NgbModalModule,
|
||||||
|
NgbPopoverModule,
|
||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { HttpClientModule } from '@angular/common/http'
|
import { HttpClientModule } from '@angular/common/http'
|
||||||
import { TextComponent } from '../input/text/text.component'
|
import { TextComponent } from '../input/text/text.component'
|
||||||
@ -60,6 +61,7 @@ describe('ProfileEditDialogComponent', () => {
|
|||||||
NgbModalModule,
|
NgbModalModule,
|
||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
NgxBootstrapIconsModule.pick(allIcons),
|
NgxBootstrapIconsModule.pick(allIcons),
|
||||||
|
NgbPopoverModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
profileService = TestBed.inject(ProfileService)
|
profileService = TestBed.inject(ProfileService)
|
||||||
@ -158,6 +160,7 @@ describe('ProfileEditDialogComponent', () => {
|
|||||||
'getSocialAccountProviders'
|
'getSocialAccountProviders'
|
||||||
)
|
)
|
||||||
getProvidersSpy.mockReturnValue(of(socialAccountProviders))
|
getProvidersSpy.mockReturnValue(of(socialAccountProviders))
|
||||||
|
component.hasUsablePassword = true
|
||||||
component.ngOnInit()
|
component.ngOnInit()
|
||||||
component.form.get('password').patchValue('new*pass')
|
component.form.get('password').patchValue('new*pass')
|
||||||
component.onPasswordKeyUp({
|
component.onPasswordKeyUp({
|
||||||
|
@ -31,6 +31,7 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
private newPassword: string
|
private newPassword: string
|
||||||
private passwordConfirm: string
|
private passwordConfirm: string
|
||||||
public showPasswordConfirm: boolean = false
|
public showPasswordConfirm: boolean = false
|
||||||
|
public hasUsablePassword: boolean = false
|
||||||
|
|
||||||
private currentEmail: string
|
private currentEmail: string
|
||||||
private newEmail: string
|
private newEmail: string
|
||||||
@ -63,6 +64,7 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
this.onEmailChange()
|
this.onEmailChange()
|
||||||
})
|
})
|
||||||
this.currentPassword = profile.password
|
this.currentPassword = profile.password
|
||||||
|
this.hasUsablePassword = profile.has_usable_password
|
||||||
this.form.get('password').valueChanges.subscribe((newPassword) => {
|
this.form.get('password').valueChanges.subscribe((newPassword) => {
|
||||||
this.newPassword = newPassword
|
this.newPassword = newPassword
|
||||||
this.onPasswordChange()
|
this.onPasswordChange()
|
||||||
|
@ -16,4 +16,5 @@ export interface PaperlessUserProfile {
|
|||||||
last_name?: string
|
last_name?: string
|
||||||
auth_token?: string
|
auth_token?: string
|
||||||
social_accounts?: SocialAccount[]
|
social_accounts?: SocialAccount[]
|
||||||
|
has_usable_password?: boolean
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,7 @@ class ProfileSerializer(serializers.ModelSerializer):
|
|||||||
"last_name",
|
"last_name",
|
||||||
"auth_token",
|
"auth_token",
|
||||||
"social_accounts",
|
"social_accounts",
|
||||||
|
"has_usable_password",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user