Finished implementing user settings -> security
This commit is contained in:
12
package-lock.json
generated
12
package-lock.json
generated
@@ -27,9 +27,11 @@
|
|||||||
"@taiga-ui/addon-table": "^5.1.0",
|
"@taiga-ui/addon-table": "^5.1.0",
|
||||||
"@taiga-ui/cdk": "^5.1.0",
|
"@taiga-ui/cdk": "^5.1.0",
|
||||||
"@taiga-ui/core": "^5.1.0",
|
"@taiga-ui/core": "^5.1.0",
|
||||||
|
"@taiga-ui/i18n": "^5.2.0",
|
||||||
"@taiga-ui/icons": "^5.1.0",
|
"@taiga-ui/icons": "^5.1.0",
|
||||||
"@taiga-ui/kit": "^5.1.0",
|
"@taiga-ui/kit": "^5.1.0",
|
||||||
"@taiga-ui/layout": "^5.1.0",
|
"@taiga-ui/layout": "^5.1.0",
|
||||||
|
"libphonenumber-js": "^1.12.41",
|
||||||
"ngx-cookie-service": "^21.3.1",
|
"ngx-cookie-service": "^21.3.1",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
@@ -4384,11 +4386,10 @@
|
|||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/@taiga-ui/i18n": {
|
"node_modules/@taiga-ui/i18n": {
|
||||||
"version": "5.1.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-5.2.0.tgz",
|
||||||
"integrity": "sha512-NqCo1fK95w6aXHkvIZ3aqZOA2z+CnvD/eEEXZjbCs/Ik6QfWmGP8GbS5uwb7SzqNZz9QiVaJi5RNZtoInHf/tQ==",
|
"integrity": "sha512-dyjp5hqDR272EPX+aQVtCXKiFKEUggdf1Y/Gcdt4JGZ0WqYR5n5CjP1EoKRG3GQcgd1mCSXnAt2BQJpujGcaHw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": ">=2.8.1"
|
"tslib": ">=2.8.1"
|
||||||
},
|
},
|
||||||
@@ -7061,8 +7062,7 @@
|
|||||||
"version": "1.12.41",
|
"version": "1.12.41",
|
||||||
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.12.41.tgz",
|
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.12.41.tgz",
|
||||||
"integrity": "sha512-lsmMmGXBxXIK/VMLEj0kL6MtUs1kBGj1nTCzi6zgQoG1DEwqwt2DQyHxcLykceIxAnfE3hya7NuIh6PpC6S3fA==",
|
"integrity": "sha512-lsmMmGXBxXIK/VMLEj0kL6MtUs1kBGj1nTCzi6zgQoG1DEwqwt2DQyHxcLykceIxAnfE3hya7NuIh6PpC6S3fA==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/listr2": {
|
"node_modules/listr2": {
|
||||||
"version": "9.0.5",
|
"version": "9.0.5",
|
||||||
|
|||||||
@@ -30,9 +30,11 @@
|
|||||||
"@taiga-ui/addon-table": "^5.1.0",
|
"@taiga-ui/addon-table": "^5.1.0",
|
||||||
"@taiga-ui/cdk": "^5.1.0",
|
"@taiga-ui/cdk": "^5.1.0",
|
||||||
"@taiga-ui/core": "^5.1.0",
|
"@taiga-ui/core": "^5.1.0",
|
||||||
|
"@taiga-ui/i18n": "^5.2.0",
|
||||||
"@taiga-ui/icons": "^5.1.0",
|
"@taiga-ui/icons": "^5.1.0",
|
||||||
"@taiga-ui/kit": "^5.1.0",
|
"@taiga-ui/kit": "^5.1.0",
|
||||||
"@taiga-ui/layout": "^5.1.0",
|
"@taiga-ui/layout": "^5.1.0",
|
||||||
|
"libphonenumber-js": "^1.12.41",
|
||||||
"ngx-cookie-service": "^21.3.1",
|
"ngx-cookie-service": "^21.3.1",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "Chatenium Nexum 3.0 Beta 8 (April 17, 2026)",
|
"version": "Chatenium Nexum 3.0 Beta 9 (April 19, 2026)",
|
||||||
"ok": "Ok",
|
"ok": "Ok",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"aChatProgram": "A messaging platform that you can trust.",
|
"aChatProgram": "A messaging platform that you can trust.",
|
||||||
@@ -111,6 +111,7 @@
|
|||||||
"label": "Change password",
|
"label": "Change password",
|
||||||
"labelSet": "Set password",
|
"labelSet": "Set password",
|
||||||
"labelRemove": "Remove password",
|
"labelRemove": "Remove password",
|
||||||
|
"warn": "After you change your password, you will be logged out of all your sessions.",
|
||||||
"currentPassword": "Current password",
|
"currentPassword": "Current password",
|
||||||
"newPassword": "New password",
|
"newPassword": "New password",
|
||||||
"newPasswordRepeat": "Repeat new password"
|
"newPasswordRepeat": "Repeat new password"
|
||||||
@@ -119,11 +120,22 @@
|
|||||||
"label": "Change e-mail address",
|
"label": "Change e-mail address",
|
||||||
"labelSet": "Set e-mail address",
|
"labelSet": "Set e-mail address",
|
||||||
"labelRemove": "Remove e-mail address",
|
"labelRemove": "Remove e-mail address",
|
||||||
|
"warn": "After you change your e-mail address, you will be logged out of all your sessions.",
|
||||||
"newMail": "New e-mail address",
|
"newMail": "New e-mail address",
|
||||||
"currentPassword": "Current password",
|
"currentPassword": "Current password",
|
||||||
"oldCode": "Code sent to the old e-mail address",
|
"oldCode": "Code sent to the old e-mail address",
|
||||||
"newCode": "Code sent to the new e-mail address"
|
"newCode": "Code sent to the new e-mail address"
|
||||||
},
|
},
|
||||||
|
"changePhoneDialog": {
|
||||||
|
"label": "Change phone number",
|
||||||
|
"labelSet": "Set phone number",
|
||||||
|
"labelRemove": "Remove phone number",
|
||||||
|
"warn": "After you change your phone number, you will be logged out of all your sessions.",
|
||||||
|
"newPhone": "New phone number",
|
||||||
|
"currentPassword": "Current password",
|
||||||
|
"oldCode": "Code sent to the old phone number",
|
||||||
|
"newCode": "Code sent to the new phone number"
|
||||||
|
},
|
||||||
"label": "Keep your account safe by using as much sign in methods as possible. Also check your credentials regularly to keep them up to date.",
|
"label": "Keep your account safe by using as much sign in methods as possible. Also check your credentials regularly to keep them up to date.",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"set": "Set",
|
"set": "Set",
|
||||||
@@ -206,12 +218,8 @@
|
|||||||
"changeLogDialog": {
|
"changeLogDialog": {
|
||||||
"label": "Chatenium has been updated",
|
"label": "Chatenium has been updated",
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
"1": "Optimized the loading of chats and networks",
|
"1": "Started implementing user settings, Privacy & Security is now available.",
|
||||||
"2": "Added skeleton loaders for messages inside DMs and channels",
|
"2": "Enabled Chatenium Pictures on mobile devices."
|
||||||
"3": "Added tabs in networks",
|
|
||||||
"4": "Added option to edit network name",
|
|
||||||
"5": "Added option to change network visibility",
|
|
||||||
"6": "Fixed overflow issues in the mobile UI"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chatnav": {
|
"chatnav": {
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {routes} from './app.routes';
|
|||||||
import {provideTranslateService} from '@ngx-translate/core';
|
import {provideTranslateService} from '@ngx-translate/core';
|
||||||
import {provideTranslateHttpLoader} from '@ngx-translate/http-loader';
|
import {provideTranslateHttpLoader} from '@ngx-translate/http-loader';
|
||||||
import {provideServiceWorker} from '@angular/service-worker';
|
import {provideServiceWorker} from '@angular/service-worker';
|
||||||
|
import {tuiInputPhoneInternationalOptionsProvider} from '@taiga-ui/kit';
|
||||||
|
import {defer} from 'rxjs';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
@@ -25,6 +27,11 @@ export const appConfig: ApplicationConfig = {
|
|||||||
provideServiceWorker('ngsw-worker.js', {
|
provideServiceWorker('ngsw-worker.js', {
|
||||||
enabled: !isDevMode(),
|
enabled: !isDevMode(),
|
||||||
registrationStrategy: 'registerWhenStable:30000'
|
registrationStrategy: 'registerWhenStable:30000'
|
||||||
})
|
}),
|
||||||
|
tuiInputPhoneInternationalOptionsProvider({
|
||||||
|
metadata: defer(async () =>
|
||||||
|
import('libphonenumber-js/max/metadata').then((m) => m.default),
|
||||||
|
),
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.1"|translate }}</li>
|
<li>{{ "chat.changeLogDialog.changeLog.1"|translate }}</li>
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.2"|translate }}</li>
|
<li>{{ "chat.changeLogDialog.changeLog.2"|translate }}</li>
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.3"|translate }}</li>
|
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.4"|translate }}</li>
|
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.5"|translate }}</li>
|
|
||||||
<li>{{ "chat.changeLogDialog.changeLog.6"|translate }}</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<button tuiButton iconStart="@tui.check"
|
<button tuiButton iconStart="@tui.check"
|
||||||
@@ -16,7 +12,7 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template [(tuiDialog)]="userSettingsOpen" [tuiDialogOptions]="{closable: false, appearance: 'taiga big'}" class="user-settings">
|
<ng-template [(tuiDialog)]="userSettingsOpen" [tuiDialogOptions]="{closable: false, appearance: 'taiga big'}" class="user-settings">
|
||||||
<user-settings/>
|
<user-settings (close)="userSettingsOpen.set(false)"/>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
@if (serviceManager.currentSession() == null) {
|
@if (serviceManager.currentSession() == null) {
|
||||||
@@ -40,7 +36,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</tui-segmented>
|
</tui-segmented>
|
||||||
|
|
||||||
<button id="bottom_btn" tuiButton appearance="flat" disabled>
|
<button id="bottom_btn" tuiButton [appearance]="userSettingsOpen() ? 'primary' : 'flat'" (click)="userSettingsOpen.set(true)">
|
||||||
<tui-icon icon="@tui.cog"/>
|
<tui-icon icon="@tui.cog"/>
|
||||||
</button>
|
</button>
|
||||||
</aside>
|
</aside>
|
||||||
@@ -94,6 +90,13 @@
|
|||||||
<network-list [token]="serviceManager.currentSession()!.token"
|
<network-list [token]="serviceManager.currentSession()!.token"
|
||||||
[userid]="serviceManager.currentSession()!.userData.userid"></network-list>
|
[userid]="serviceManager.currentSession()!.userData.userid"></network-list>
|
||||||
}
|
}
|
||||||
|
@case (2) {
|
||||||
|
<app-picture-list [token]="serviceManager.currentSession()!.token"
|
||||||
|
[userid]="serviceManager.currentSession()!.userData.userid"></app-picture-list>
|
||||||
|
}
|
||||||
|
@case (3) {
|
||||||
|
<user-settings/>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -114,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (router.url.startsWith("/chat/dm")) {
|
@if (router.url.startsWith("/chat/dm") || router.url.startsWith("/chat/picture")) {
|
||||||
<!-- To ensure data is loaded -->
|
<!-- To ensure data is loaded -->
|
||||||
@defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
|
@defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
|
||||||
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"/>
|
<router-outlet (activate)="routerOutletActive.set(true)" (deactivate)="routerOutletActive.set(false)"/>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class Chat implements OnInit {
|
|||||||
router = inject(Router)
|
router = inject(Router)
|
||||||
|
|
||||||
routerOutletActive = signal(false)
|
routerOutletActive = signal(false)
|
||||||
userSettingsOpen = signal(true)
|
userSettingsOpen = signal(false)
|
||||||
|
|
||||||
navigationActiveIndex = 0
|
navigationActiveIndex = 0
|
||||||
// Mobile navigation //
|
// Mobile navigation //
|
||||||
@@ -65,12 +65,12 @@ export class Chat implements OnInit {
|
|||||||
{
|
{
|
||||||
text: "chat.tabBar.tab3",
|
text: "chat.tabBar.tab3",
|
||||||
icon: '@tui.image',
|
icon: '@tui.image',
|
||||||
implemented: false,
|
implemented: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "chat.tabBar.tab4",
|
text: "chat.tabBar.tab4",
|
||||||
icon: '@tui.cog',
|
icon: '@tui.cog',
|
||||||
implemented: false,
|
implemented: true,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<div class="option">
|
<div class="option" [class.mobile]="breakpoint() == 'mobile'">
|
||||||
<ng-template [(tuiDialog)]="changeEmailDialogOpen"
|
<ng-template [(tuiDialog)]="changeEmailDialogOpen"
|
||||||
[tuiDialogOptions]="{label: ('chat.userSettingsDialog.security.changeEmailDialog.'+ (changeEmailRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.emailSet ? 'label' : 'labelSet'))|translate}">
|
[tuiDialogOptions]="{label: ('chat.userSettingsDialog.security.changeEmailDialog.'+ (changeEmailRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.emailSet ? 'label' : 'labelSet'))|translate}">
|
||||||
|
<p>{{ "chat.userSettingsDialog.security.changeEmailDialog.warn"|translate }}</p>
|
||||||
@if (step() == 0) {
|
@if (step() == 0) {
|
||||||
<form [formGroup]="changeEmailForm" style="display: flex; flex-direction: column; gap: 10px">
|
<form [formGroup]="changeEmailForm" style="display: flex; flex-direction: column; gap: 10px">
|
||||||
@if (!changeEmailRemoveMode()) {
|
@if (!changeEmailRemoveMode()) {
|
||||||
<tui-textfield iconStart="@tui.mail">
|
<tui-textfield iconStart="@tui.mail">
|
||||||
<label
|
<label
|
||||||
tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.newMail"|translate }}</label>
|
tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.newMail"|translate }}</label>
|
||||||
<input formControlName="currentPassword" tuiInput type="email">
|
<input formControlName="newAddress" tuiInput type="email">
|
||||||
</tui-textfield>
|
</tui-textfield>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,23 +33,25 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<button tuiButton iconStart="@tui.check" [loading]="changeEmailPending()"
|
<button tuiButton iconStart="@tui.check" [loading]="changeEmailPending()"
|
||||||
[disabled]="changeEmailPending()"
|
[disabled]="changeEmailPending()"
|
||||||
(click)="changeEmail(changeEmailForm.controls['newAddress'].value, changeEmailForm.controls['currentPassword'].value)">
|
(click)="changeEmail(changeEmailForm.controls['currentPassword'].value, changeEmailForm.controls['newAddress'].value)">
|
||||||
{{ ('chat.userSettingsDialog.security.changeEmailDialog.' + (changeEmailRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate }}
|
{{ ('chat.userSettingsDialog.security.changeEmailDialog.' + (changeEmailRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate }}
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
} @else {
|
} @else {
|
||||||
<form style="display: flex; flex-direction: column; gap: 10px" [formGroup]="verifyEmailForm">
|
<form style="display: flex; flex-direction: column; gap: 10px" [formGroup]="verifyEmailForm">
|
||||||
@if (!changeEmailRemoveMode()) {
|
@if (serviceManager.currentSession()!.userData.emailSet) {
|
||||||
<tui-textfield iconStart="@tui.mail">
|
<tui-textfield iconStart="@tui.mail">
|
||||||
<label tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.oldCode"|translate }}</label>
|
<label tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.oldCode"|translate }}</label>
|
||||||
<input tuiInput type="number" [step]="1" formControlName="oldCode">
|
<input tuiInput type="number" [step]="1" formControlName="oldCode">
|
||||||
</tui-textfield>
|
</tui-textfield>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (!changeEmailRemoveMode()) {
|
||||||
<tui-textfield iconStart="@tui.badge-plus">
|
<tui-textfield iconStart="@tui.badge-plus">
|
||||||
<label tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.newCode"|translate }}</label>
|
<label tuiLabel>{{ "chat.userSettingsDialog.security.changeEmailDialog.newCode"|translate }}</label>
|
||||||
<input tuiInput type="number" [step]="1" formControlName="newCode">
|
<input tuiInput type="number" [step]="1" formControlName="newCode">
|
||||||
</tui-textfield>
|
</tui-textfield>
|
||||||
|
}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
@@ -87,7 +90,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
@if (serviceManager.currentSession()!.userData.emailSet) {
|
@if (serviceManager.currentSession()!.userData.emailSet) {
|
||||||
<button tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x"
|
<button tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x" [disabled]="!serviceManager.currentSession()!.userData.phoneSet && !serviceManager.currentSession()!.userData.phoneSet"
|
||||||
(click)="openChangeEmailDialog(true)"
|
(click)="openChangeEmailDialog(true)"
|
||||||
style="color: var(--tui-text-negative)">
|
style="color: var(--tui-text-negative)">
|
||||||
{{ "chat.userSettingsDialog.security.removeMail"|translate }}
|
{{ "chat.userSettingsDialog.security.removeMail"|translate }}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {Component, inject, signal} from '@angular/core';
|
|||||||
import {TranslatePipe} from '@ngx-translate/core';
|
import {TranslatePipe} from '@ngx-translate/core';
|
||||||
import {TuiBadge, TuiButtonLoading, TuiInputNumber} from '@taiga-ui/kit';
|
import {TuiBadge, TuiButtonLoading, TuiInputNumber} from '@taiga-ui/kit';
|
||||||
import {
|
import {
|
||||||
|
TUI_BREAKPOINT,
|
||||||
TuiButton,
|
TuiButton,
|
||||||
TuiDialog,
|
TuiDialog,
|
||||||
TuiErrorComponent,
|
TuiErrorComponent,
|
||||||
@@ -41,6 +42,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class Email {
|
export class Email {
|
||||||
serviceManager = inject(ServiceManager)
|
serviceManager = inject(ServiceManager)
|
||||||
|
breakpoint = inject(TUI_BREAKPOINT)
|
||||||
|
|
||||||
step = signal(0)
|
step = signal(0)
|
||||||
changeEmailDialogOpen = signal(false)
|
changeEmailDialogOpen = signal(false)
|
||||||
@@ -74,18 +76,22 @@ export class Email {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async changeEmail(currentPassword: string | null, newMail: string | null) {
|
async changeEmail(currentPassword: string | null, newMail: string | null) {
|
||||||
|
if (this.changeEmailRemoveMode()) {
|
||||||
|
newMail = "remove"
|
||||||
|
}
|
||||||
this.changeEmailPending.set(true)
|
this.changeEmailPending.set(true)
|
||||||
const service = this.serviceManager.currentSessionHandler
|
const service = this.serviceManager.currentSessionHandler
|
||||||
if (service) {
|
if (service) {
|
||||||
try {
|
try {
|
||||||
await service.changeEmail(newMail ?? "", currentPassword ?? "")
|
await service.changeEmail(newMail ?? "", currentPassword ?? "")
|
||||||
if (!this.changeEmailRemoveMode()) {
|
|
||||||
this.newAddress = newMail ?? ""
|
|
||||||
this.verifyEmailForm.controls["oldCode"].setValidators([Validators.required])
|
|
||||||
this.step.set(1)
|
this.step.set(1)
|
||||||
|
this.newAddress = newMail ?? ""
|
||||||
|
if (!this.changeEmailRemoveMode()) {
|
||||||
|
this.verifyEmailForm.controls["oldCode"].setValidators([Validators.required])
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.changeEmailForm.controls["currentPassword"].setErrors({incorrect: true})
|
this.changeEmailForm.controls["currentPassword"].setErrors({incorrect: true})
|
||||||
|
this.changeEmailPending.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +105,7 @@ export class Email {
|
|||||||
this.changeEmailDialogOpen.set(false)
|
this.changeEmailDialogOpen.set(false)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.verifyEmailForm.controls["newCode"].setErrors({incorrect: true})
|
this.verifyEmailForm.controls["newCode"].setErrors({incorrect: true})
|
||||||
|
this.verifyEmailPending.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<div class="option">
|
<div class="option" [class.mobile]="breakpoint() == 'mobile'">
|
||||||
<ng-template [(tuiDialog)]="changePasswordDialogOpen"
|
<ng-template [(tuiDialog)]="changePasswordDialogOpen"
|
||||||
[tuiDialogOptions]="{label: ('chat.userSettingsDialog.security.changePasswordDialog.'+ (changePasswordRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate}">
|
[tuiDialogOptions]="{label: ('chat.userSettingsDialog.security.changePasswordDialog.'+ (changePasswordRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate}">
|
||||||
|
<p>{{"chat.userSettingsDialog.security.changePasswordDialog.warn"|translate}}</p>
|
||||||
<form [formGroup]="changeEmailForm" style="display: flex; flex-direction: column; gap: 10px">
|
<form [formGroup]="changeEmailForm" style="display: flex; flex-direction: column; gap: 10px">
|
||||||
@if (serviceManager.currentSession()!.userData.passwordSet) {
|
@if (serviceManager.currentSession()!.userData.passwordSet) {
|
||||||
<tui-textfield iconStart="@tui.key">
|
<tui-textfield iconStart="@tui.key">
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
@if (serviceManager.currentSession()!.userData.passwordSet) {
|
@if (serviceManager.currentSession()!.userData.passwordSet) {
|
||||||
<button tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x"
|
<button tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x" [disabled]="!serviceManager.currentSession()!.userData.phoneSet && !serviceManager.currentSession()!.userData.emailSet"
|
||||||
style="color: var(--tui-text-negative)" (click)="openChangePasswordDialog(true)">
|
style="color: var(--tui-text-negative)" (click)="openChangePasswordDialog(true)">
|
||||||
{{ "chat.userSettingsDialog.security.removePassword"|translate }}
|
{{ "chat.userSettingsDialog.security.removePassword"|translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
import {TranslatePipe} from '@ngx-translate/core';
|
import {TranslatePipe} from '@ngx-translate/core';
|
||||||
import {TuiBadge, TuiButtonLoading} from '@taiga-ui/kit';
|
import {TuiBadge, TuiButtonLoading} from '@taiga-ui/kit';
|
||||||
import {
|
import {
|
||||||
|
TUI_BREAKPOINT,
|
||||||
TuiButton,
|
TuiButton,
|
||||||
TuiDialog,
|
TuiDialog,
|
||||||
TuiErrorComponent,
|
TuiErrorComponent,
|
||||||
@@ -42,6 +43,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class Password {
|
export class Password {
|
||||||
serviceManager = inject(ServiceManager)
|
serviceManager = inject(ServiceManager)
|
||||||
|
breakpoint = inject(TUI_BREAKPOINT)
|
||||||
|
|
||||||
changePasswordDialogOpen = signal(false)
|
changePasswordDialogOpen = signal(false)
|
||||||
changePasswordRemoveMode = signal(false)
|
changePasswordRemoveMode = signal(false)
|
||||||
|
|||||||
99
src/app/chat/user-settings/security/phone/phone.html
Normal file
99
src/app/chat/user-settings/security/phone/phone.html
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<div class="option" [class.mobile]="breakpoint() == 'mobile'">
|
||||||
|
<ng-template [(tuiDialog)]="changePhoneDialogOpen"
|
||||||
|
[tuiDialogOptions]="{label: ('chat.userSettingsDialog.security.changePhoneDialog.'+ (changePhoneRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.phoneSet ? 'label' : 'labelSet'))|translate}">
|
||||||
|
<p>{{ "chat.userSettingsDialog.security.changePhoneDialog.warn"|translate }}</p>
|
||||||
|
@if (step() == 0) {
|
||||||
|
<form [formGroup]="changePhoneForm" style="display: flex; flex-direction: column; gap: 10px">
|
||||||
|
@if (!changePhoneRemoveMode()) {
|
||||||
|
<tui-textfield>
|
||||||
|
<label
|
||||||
|
tuiLabel>{{ "chat.userSettingsDialog.security.changePhoneDialog.newPhone"|translate }}</label>
|
||||||
|
<input formControlName="newNumber" tuiInputPhoneInternational [countrySearch]="true" [countries]="countries | tuiSortCountries" [(countryIsoCode)]="countryIsoCode">
|
||||||
|
</tui-textfield>
|
||||||
|
}
|
||||||
|
|
||||||
|
<tui-textfield iconStart="@tui.key">
|
||||||
|
<label tuiLabel>{{ "chat.userSettingsDialog.security.changePhoneDialog.currentPassword"|translate }}</label>
|
||||||
|
<input formControlName="currentPassword" tuiInput type="password">
|
||||||
|
</tui-textfield>
|
||||||
|
|
||||||
|
@if (changePhoneForm.controls['currentPassword'].dirty) {
|
||||||
|
@if (changePhoneForm.controls['currentPassword'].hasError("required")) {
|
||||||
|
<tui-error
|
||||||
|
[error]="'chat.userSettingsDialog.security.changePhoneDialog.errors.currentPasswordRequired'|translate"></tui-error>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (changePhoneForm.controls['currentPassword'].hasError("incorrect")) {
|
||||||
|
<tui-error
|
||||||
|
[error]="'chat.userSettingsDialog.security.changePhoneDialog.errors.incorrectPassword'|translate"></tui-error>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<button tuiButton iconStart="@tui.check" [loading]="changePhonePending()"
|
||||||
|
[disabled]="changePhonePending()"
|
||||||
|
(click)="changePhone(changePhoneForm.controls['currentPassword'].value, changePhoneForm.controls['newNumber'].value)">
|
||||||
|
{{ ('chat.userSettingsDialog.security.changePhoneDialog.' + (changePhoneRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate }}
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
} @else {
|
||||||
|
<form style="display: flex; flex-direction: column; gap: 10px" [formGroup]="verifyPhoneForm">
|
||||||
|
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
||||||
|
<tui-textfield iconStart="@tui.phone">
|
||||||
|
<label tuiLabel>{{ "chat.userSettingsDialog.security.changePhoneDialog.oldCode"|translate }}</label>
|
||||||
|
<input tuiInput type="number" [step]="1" formControlName="oldCode">
|
||||||
|
</tui-textfield>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!changePhoneRemoveMode()) {
|
||||||
|
<tui-textfield iconStart="@tui.badge-plus">
|
||||||
|
<label tuiLabel>{{ "chat.userSettingsDialog.security.changePhoneDialog.newCode"|translate }}</label>
|
||||||
|
<input tuiInput type="number" [step]="1" formControlName="newCode">
|
||||||
|
</tui-textfield>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<button tuiButton iconStart="@tui.check" [loading]="verifyPhonePending()"
|
||||||
|
[disabled]="verifyPhoneForm.invalid || verifyPhonePending()"
|
||||||
|
(click)="verifyPhone(verifyPhoneForm.controls['newCode'].value, verifyPhoneForm.controls['oldCode'].value)">
|
||||||
|
{{ ('chat.userSettingsDialog.security.changePhoneDialog.' + (changePhoneRemoveMode() ? 'labelRemove' : serviceManager.currentSession()!.userData.passwordSet ? 'label' : 'labelSet'))|translate }}
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<tui-icon icon="@tui.phone"/>
|
||||||
|
<span>{{ "chat.userSettingsDialog.security.phoneNumber"|translate }}</span>
|
||||||
|
|
||||||
|
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
||||||
|
<div tuiBadge appearance="positive"
|
||||||
|
iconStart="@tui.check">{{ 'chat.userSettingsDialog.security.set'|translate }}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div tuiBadge appearance="negative"
|
||||||
|
iconStart="@tui.x">{{ 'chat.userSettingsDialog.security.notSet'|translate }}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<button tuiButton appearance="outline" (click)="openChangePhoneDialog(false)"
|
||||||
|
[iconStart]="serviceManager.currentSession()!.userData.phoneSet ? '@tui.pencil' : '@tui.plus'">
|
||||||
|
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
||||||
|
{{ "chat.userSettingsDialog.security.changePhone"|translate }}
|
||||||
|
} @else {
|
||||||
|
{{ "chat.userSettingsDialog.security.setPhone"|translate }}
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
||||||
|
<button [disabled]="!serviceManager.currentSession()!.userData.passwordSet && !serviceManager.currentSession()!.userData.emailSet" tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x" (click)="openChangePhoneDialog(true)"
|
||||||
|
style="color: var(--tui-text-negative)">
|
||||||
|
{{ "chat.userSettingsDialog.security.removePhone"|translate }}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
22
src/app/chat/user-settings/security/phone/phone.spec.ts
Normal file
22
src/app/chat/user-settings/security/phone/phone.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Phone } from './phone';
|
||||||
|
|
||||||
|
describe('Phone', () => {
|
||||||
|
let component: Phone;
|
||||||
|
let fixture: ComponentFixture<Phone>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Phone],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Phone);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
await fixture.whenStable();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
111
src/app/chat/user-settings/security/phone/phone.ts
Normal file
111
src/app/chat/user-settings/security/phone/phone.ts
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import {Component, inject, signal} from '@angular/core';
|
||||||
|
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||||
|
import {TranslatePipe} from '@ngx-translate/core';
|
||||||
|
import {TuiBadge, TuiButtonLoading, TuiInputPhoneInternationalComponent, TuiSortCountriesPipe} from '@taiga-ui/kit';
|
||||||
|
import {
|
||||||
|
TUI_BREAKPOINT,
|
||||||
|
TuiButton,
|
||||||
|
TuiDialog,
|
||||||
|
TuiErrorComponent,
|
||||||
|
TuiIcon,
|
||||||
|
TuiInputDirective,
|
||||||
|
TuiLabel,
|
||||||
|
TuiTextfieldComponent
|
||||||
|
} from '@taiga-ui/core';
|
||||||
|
import {ServiceManager} from '../../../../service-manager';
|
||||||
|
import {getCountries} from 'libphonenumber-js';
|
||||||
|
import {TuiCountryIsoCode} from '@taiga-ui/i18n';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'user-settings-security-phone',
|
||||||
|
imports: [
|
||||||
|
ReactiveFormsModule,
|
||||||
|
TranslatePipe,
|
||||||
|
TuiBadge,
|
||||||
|
TuiButton,
|
||||||
|
TuiButtonLoading,
|
||||||
|
TuiDialog,
|
||||||
|
TuiErrorComponent,
|
||||||
|
TuiIcon,
|
||||||
|
TuiInputDirective,
|
||||||
|
TuiLabel,
|
||||||
|
TuiTextfieldComponent,
|
||||||
|
TuiInputPhoneInternationalComponent,
|
||||||
|
TuiSortCountriesPipe
|
||||||
|
],
|
||||||
|
templateUrl: './phone.html',
|
||||||
|
styleUrl: './phone.scss',
|
||||||
|
})
|
||||||
|
export class Phone {
|
||||||
|
protected readonly countries = getCountries();
|
||||||
|
protected countryIsoCode: TuiCountryIsoCode = 'HU';
|
||||||
|
breakpoint = inject(TUI_BREAKPOINT)
|
||||||
|
|
||||||
|
serviceManager = inject(ServiceManager)
|
||||||
|
|
||||||
|
step = signal(0)
|
||||||
|
changePhoneDialogOpen = signal(false)
|
||||||
|
changePhoneRemoveMode = signal(false)
|
||||||
|
changePhonePending = signal(false)
|
||||||
|
verifyPhonePending = signal(false)
|
||||||
|
newNumber = ""
|
||||||
|
|
||||||
|
changePhoneForm = new FormGroup({
|
||||||
|
newNumber: new FormControl(""),
|
||||||
|
currentPassword: new FormControl(""),
|
||||||
|
})
|
||||||
|
|
||||||
|
verifyPhoneForm = new FormGroup({
|
||||||
|
oldCode: new FormControl(0),
|
||||||
|
newCode: new FormControl(0, {validators: [Validators.required]})
|
||||||
|
})
|
||||||
|
|
||||||
|
openChangePhoneDialog(modeRemove: boolean) {
|
||||||
|
this.changePhoneDialogOpen.set(true)
|
||||||
|
this.changePhoneRemoveMode.set(modeRemove)
|
||||||
|
this.changePhoneForm.controls["currentPassword"].clearValidators()
|
||||||
|
this.changePhoneForm.controls["newNumber"].clearValidators()
|
||||||
|
if (!modeRemove) {
|
||||||
|
this.changePhoneForm.controls["newNumber"].setValidators([Validators.required])
|
||||||
|
this.changePhoneForm.controls["newNumber"].updateValueAndValidity()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changePhoneForm.controls["currentPassword"].setValidators([Validators.required])
|
||||||
|
this.changePhoneForm.controls["currentPassword"].updateValueAndValidity()
|
||||||
|
}
|
||||||
|
|
||||||
|
async changePhone(currentPassword: string | null, newNumber: string | null) {
|
||||||
|
if (this.changePhoneRemoveMode()) {
|
||||||
|
newNumber = "remove"
|
||||||
|
}
|
||||||
|
this.changePhonePending.set(true)
|
||||||
|
const service = this.serviceManager.currentSessionHandler
|
||||||
|
if (service) {
|
||||||
|
try {
|
||||||
|
await service.changePhoneNumber(currentPassword ?? "", newNumber ?? "")
|
||||||
|
this.step.set(1)
|
||||||
|
this.newNumber = newNumber ?? ""
|
||||||
|
if (!this.changePhoneRemoveMode()) {
|
||||||
|
this.verifyPhoneForm.controls["oldCode"].setValidators([Validators.required])
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.changePhoneForm.controls["currentPassword"].setErrors({incorrect: true})
|
||||||
|
this.changePhonePending.set(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async verifyPhone(newCode: number | null, oldCode: number | null) {
|
||||||
|
this.verifyPhonePending.set(true)
|
||||||
|
const service = this.serviceManager.currentSessionHandler
|
||||||
|
if (service) {
|
||||||
|
try {
|
||||||
|
await service.verifyPhoneNumberChange(this.newNumber, oldCode ?? 0, newCode ?? 0)
|
||||||
|
this.changePhoneDialogOpen.set(false)
|
||||||
|
} catch (e) {
|
||||||
|
this.verifyPhoneForm.controls["newCode"].setErrors({incorrect: true})
|
||||||
|
this.verifyPhonePending.set(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,38 +5,5 @@
|
|||||||
<div id="options" tuiGroup orientation="vertical">
|
<div id="options" tuiGroup orientation="vertical">
|
||||||
<user-settings-security-password/>
|
<user-settings-security-password/>
|
||||||
<user-settings-security-email/>
|
<user-settings-security-email/>
|
||||||
<div class="option">
|
<user-settings-security-phone/>
|
||||||
<header>
|
|
||||||
<tui-icon icon="@tui.phone"/>
|
|
||||||
<span>{{ "chat.userSettingsDialog.security.phoneNumber"|translate }}</span>
|
|
||||||
|
|
||||||
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
|
||||||
<div tuiBadge appearance="positive"
|
|
||||||
iconStart="@tui.check">{{ 'chat.userSettingsDialog.security.set'|translate }}
|
|
||||||
</div>
|
|
||||||
} @else {
|
|
||||||
<div tuiBadge appearance="negative"
|
|
||||||
iconStart="@tui.x">{{ 'chat.userSettingsDialog.security.notSet'|translate }}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<button tuiButton appearance="outline"
|
|
||||||
[iconStart]="serviceManager.currentSession()!.userData.phoneSet ? '@tui.pencil' : '@tui.plus'">
|
|
||||||
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
|
||||||
{{ "chat.userSettingsDialog.security.changePhone"|translate }}
|
|
||||||
} @else {
|
|
||||||
{{ "chat.userSettingsDialog.security.setPhone"|translate }}
|
|
||||||
}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
@if (serviceManager.currentSession()!.userData.phoneSet) {
|
|
||||||
<button tuiButton appearance="outline" tuiAppearanceMode="invalid" iconStart="@tui.x"
|
|
||||||
style="color: var(--tui-text-negative)">
|
|
||||||
{{ "chat.userSettingsDialog.security.removePhone"|translate }}
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,6 +12,18 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
||||||
|
&.mobile {
|
||||||
|
grid-template-rows: 50px 50px;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
height: 150px;
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: flex;
|
||||||
|
justify-content: start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
::ng-deep header {
|
::ng-deep header {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import {Password} from './password/password';
|
import {Password} from './password/password';
|
||||||
import {Email} from './email/email';
|
import {Email} from './email/email';
|
||||||
|
import {Phone} from './phone/phone';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'user-settings-security',
|
selector: 'user-settings-security',
|
||||||
@@ -31,7 +32,8 @@ import {Email} from './email/email';
|
|||||||
TuiButtonLoading,
|
TuiButtonLoading,
|
||||||
TuiErrorComponent,
|
TuiErrorComponent,
|
||||||
Password,
|
Password,
|
||||||
Email
|
Email,
|
||||||
|
Phone
|
||||||
],
|
],
|
||||||
templateUrl: './security.html',
|
templateUrl: './security.html',
|
||||||
styleUrl: './security.scss',
|
styleUrl: './security.scss',
|
||||||
|
|||||||
@@ -1,24 +1,38 @@
|
|||||||
|
<div id="layout" [class.mobile]="breakpoint() != 'desktopLarge'">
|
||||||
|
@if (breakpoint() == "desktopLarge" || selectedOption == "") {
|
||||||
<aside>
|
<aside>
|
||||||
<header>
|
<header>
|
||||||
<tui-icon icon="@tui.cog"/>
|
<tui-icon icon="@tui.cog"/>
|
||||||
<h2>{{ "chat.userSettingsDialog.label"|translate }}</h2>
|
<h2>{{ "chat.userSettingsDialog.label"|translate }}</h2>
|
||||||
|
|
||||||
<button tuiButtonX></button>
|
@if (breakpoint() != "mobile") {
|
||||||
|
<button tuiButtonX (click)="close.emit()"></button>
|
||||||
|
}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="options">
|
<div id="options">
|
||||||
@for (option of options; track option) {
|
@for (option of options; track option) {
|
||||||
<button tuiButton [iconStart]="'@tui.'+option.icon" [appearance]="selectedOption == option.name ? 'primary' : 'flat'" (click)="selectedOption = option.name">
|
<button [disabled]="!option.implemented" tuiButton [iconStart]="'@tui.'+option.icon" [appearance]="selectedOption == option.name ? 'primary' : 'flat'" (click)="selectedOption = option.name">
|
||||||
{{"chat.userSettingsDialog.options."+option.name|translate}}
|
{{"chat.userSettingsDialog.options."+option.name|translate}}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (breakpoint() == "desktopLarge" || selectedOption != "") {
|
||||||
<main>
|
<main>
|
||||||
|
@if (breakpoint() != "desktopLarge") {
|
||||||
|
<div style="display: flex; align-items: center; gap: 1rem;">
|
||||||
|
<button tuiButton appearance="flat" iconStart="@tui.arrow-left" (click)="selectedOption = ''"></button>
|
||||||
|
<h3>{{"chat.userSettingsDialog.options."+selectedOption|translate}}</h3>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@switch (selectedOption) {
|
@switch (selectedOption) {
|
||||||
@case ("security") {
|
@case ("security") {
|
||||||
<user-settings-security/>
|
<user-settings-security/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</main>
|
</main>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
:host {
|
#layout {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 300px 1fr;
|
grid-template-columns: 300px 1fr;
|
||||||
|
|
||||||
|
&.mobile {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
aside, main {
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
aside {
|
aside {
|
||||||
background-color: var(--tui-background-base-alt);
|
background-color: var(--tui-background-base-alt);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import {Component, EventEmitter, inject, OnInit, Output} from '@angular/core';
|
||||||
import {TranslatePipe} from '@ngx-translate/core';
|
import {TranslatePipe} from '@ngx-translate/core';
|
||||||
import {TuiButton, TuiButtonX, TuiIcon} from '@taiga-ui/core';
|
import {TUI_BREAKPOINT, TuiButton, TuiButtonX, TuiIcon} from '@taiga-ui/core';
|
||||||
import {Security} from './security/security';
|
import {Security} from './security/security';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -15,28 +15,43 @@ import {Security} from './security/security';
|
|||||||
templateUrl: './user-settings.html',
|
templateUrl: './user-settings.html',
|
||||||
styleUrl: './user-settings.scss',
|
styleUrl: './user-settings.scss',
|
||||||
})
|
})
|
||||||
export class UserSettings {
|
export class UserSettings implements OnInit {
|
||||||
|
breakpoint = inject(TUI_BREAKPOINT)
|
||||||
|
|
||||||
|
@Output() close = new EventEmitter<void>()
|
||||||
|
|
||||||
selectedOption = "security"
|
selectedOption = "security"
|
||||||
options = [
|
options = [
|
||||||
{
|
{
|
||||||
icon: "shield",
|
icon: "shield",
|
||||||
name: "security",
|
name: "security",
|
||||||
|
implemented: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "users",
|
icon: "users",
|
||||||
name: "profile",
|
name: "profile",
|
||||||
|
implemented: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "paint-roller",
|
icon: "paint-roller",
|
||||||
name: "themes",
|
name: "themes",
|
||||||
|
implemented: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "computer",
|
icon: "computer",
|
||||||
name: "sessions"
|
name: "sessions",
|
||||||
|
implemented: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "hard-drive",
|
icon: "hard-drive",
|
||||||
name: "storage"
|
name: "storage",
|
||||||
|
implemented: false,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
if (this.breakpoint() != "desktopLarge") {
|
||||||
|
this.selectedOption = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
version: "3.0-beta8",
|
version: "3.0-beta9",
|
||||||
api_url: "http://localhost:3000",
|
api_url: "http://localhost:3000",
|
||||||
cdn_url: "http://localhost:4000",
|
cdn_url: "http://localhost:4000",
|
||||||
ws_url: "ws://localhost:3000",
|
ws_url: "ws://localhost:3000",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
version: "3.0-beta8",
|
version: "3.0-beta9",
|
||||||
api_url: "https://api.chatenium.hu",
|
api_url: "https://api.chatenium.hu",
|
||||||
cdn_url: "https://cdn.chatenium.hu",
|
cdn_url: "https://cdn.chatenium.hu",
|
||||||
ws_url: "wss://api.chatenium.hu",
|
ws_url: "wss://api.chatenium.hu",
|
||||||
|
|||||||
Reference in New Issue
Block a user