mirror of
https://github.com/bitwarden/web
synced 2025-12-11 05:43:16 +00:00
Compare commits
9 Commits
bug/ps-136
...
feature/cl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
283f295481 | ||
|
|
749ead5863 | ||
|
|
8d369bcf84 | ||
|
|
aa7fb1befb | ||
|
|
43ca31e0ae | ||
|
|
0dfc8c5a0b | ||
|
|
c1801dfc61 | ||
|
|
59a53740a4 | ||
|
|
dd2c2b9720 |
2
jslib
2
jslib
Submodule jslib updated: 65584c6496...3bf25edd3e
@@ -53,7 +53,13 @@ import localeZhTw from "@angular/common/locales/zh-Hant";
|
|||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from "@angular/router";
|
||||||
import { BadgeModule, ButtonModule, CalloutModule, MenuModule } from "@bitwarden/components";
|
import {
|
||||||
|
BadgeModule,
|
||||||
|
ButtonModule,
|
||||||
|
CalloutModule,
|
||||||
|
FormFieldModule,
|
||||||
|
MenuModule,
|
||||||
|
} from "@bitwarden/components";
|
||||||
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
import { InfiniteScrollModule } from "ngx-infinite-scroll";
|
||||||
import { ToastrModule } from "ngx-toastr";
|
import { ToastrModule } from "ngx-toastr";
|
||||||
|
|
||||||
@@ -126,6 +132,7 @@ registerLocaleData(localeZhTw, "zh-TW");
|
|||||||
BadgeModule,
|
BadgeModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
MenuModule,
|
MenuModule,
|
||||||
|
FormFieldModule,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
@@ -136,6 +143,7 @@ registerLocaleData(localeZhTw, "zh-TW");
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
BadgeModule,
|
BadgeModule,
|
||||||
|
FormFieldModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
CalloutModule,
|
CalloutModule,
|
||||||
ToastrModule,
|
ToastrModule,
|
||||||
|
|||||||
@@ -14,62 +14,50 @@
|
|||||||
#form
|
#form
|
||||||
(ngSubmit)="submit()"
|
(ngSubmit)="submit()"
|
||||||
[appApiAction]="formPromise"
|
[appApiAction]="formPromise"
|
||||||
ngNativeValidate
|
[formGroup]="formData"
|
||||||
>
|
>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="form-group">
|
<bit-form-field>
|
||||||
<label for="name">{{ "organizationName" | i18n }}</label>
|
<bit-label>{{ "organizationName" | i18n }}</bit-label>
|
||||||
<input
|
<input bitInput type="text" formControlName="name" />
|
||||||
id="name"
|
</bit-form-field>
|
||||||
class="form-control"
|
|
||||||
type="text"
|
<bit-form-field>
|
||||||
name="Name"
|
<bit-label>{{ "billingEmail" | i18n }}</bit-label>
|
||||||
[(ngModel)]="org.name"
|
<input bitInput type="email" formControlName="billingEmail" />
|
||||||
[disabled]="selfHosted"
|
</bit-form-field>
|
||||||
/>
|
|
||||||
</div>
|
<bit-form-field>
|
||||||
<div class="form-group">
|
<bit-label>{{ "businessName" | i18n }}</bit-label>
|
||||||
<label for="billingEmail">{{ "billingEmail" | i18n }}</label>
|
<input bitInput type="text" formControlName="businessName" />
|
||||||
<input
|
</bit-form-field>
|
||||||
id="billingEmail"
|
|
||||||
class="form-control"
|
<bit-form-field>
|
||||||
type="text"
|
<bit-label>{{ "identifier" | i18n }}</bit-label>
|
||||||
name="BillingEmail"
|
<input bitInput type="text" formControlName="identifier" />
|
||||||
[(ngModel)]="org.billingEmail"
|
</bit-form-field>
|
||||||
[disabled]="selfHosted || !canManageBilling"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="businessName">{{ "businessName" | i18n }}</label>
|
|
||||||
<input
|
|
||||||
id="businessName"
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
name="BusinessName"
|
|
||||||
[(ngModel)]="org.businessName"
|
|
||||||
[disabled]="selfHosted || !canManageBilling"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="identifier">{{ "identifier" | i18n }}</label>
|
|
||||||
<input
|
|
||||||
id="identifier"
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
name="Identifier"
|
|
||||||
[(ngModel)]="org.identifier"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<app-avatar data="{{ org.name }}" dynamic="true" size="75" fontSize="35"></app-avatar>
|
<app-avatar
|
||||||
|
[data]="formData.get('name').value"
|
||||||
|
dynamic="true"
|
||||||
|
size="75"
|
||||||
|
fontSize="35"
|
||||||
|
></app-avatar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
|
<button
|
||||||
|
type="submit"
|
||||||
|
bit-button
|
||||||
|
buttonType="primary"
|
||||||
|
class="btn-submit"
|
||||||
|
[disabled]="form.loading"
|
||||||
|
>
|
||||||
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
|
||||||
<span>{{ "save" | i18n }}</span>
|
<span>{{ "save" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
<bit-error-summary *ngIf="showErrorSummary" [formGroup]="formData"></bit-error-summary>
|
||||||
</form>
|
</form>
|
||||||
<ng-container *ngIf="canUseApi">
|
<ng-container *ngIf="canUseApi">
|
||||||
<div class="secondary-header border-0 mb-0">
|
<div class="secondary-header border-0 mb-0">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, ViewChild, ViewContainerRef } from "@angular/core";
|
import { Component, ViewChild, ViewContainerRef } from "@angular/core";
|
||||||
|
import { FormBuilder, Validators } from "@angular/forms";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
|
||||||
import { ModalService } from "jslib-angular/services/modal.service";
|
import { ModalService } from "jslib-angular/services/modal.service";
|
||||||
@@ -41,10 +42,19 @@ export class AccountComponent {
|
|||||||
org: OrganizationResponse;
|
org: OrganizationResponse;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
taxFormPromise: Promise<any>;
|
taxFormPromise: Promise<any>;
|
||||||
|
showErrorSummary = false;
|
||||||
|
|
||||||
private organizationId: string;
|
private organizationId: string;
|
||||||
|
|
||||||
|
formData = this.formBuilder.group({
|
||||||
|
name: ["", [Validators.required]],
|
||||||
|
billingEmail: ["", [Validators.required, Validators.email]],
|
||||||
|
businessName: [],
|
||||||
|
identifier: [],
|
||||||
|
});
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
@@ -60,6 +70,12 @@ export class AccountComponent {
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.selfHosted = this.platformUtilsService.isSelfHost();
|
this.selfHosted = this.platformUtilsService.isSelfHost();
|
||||||
|
|
||||||
|
if (this.selfHosted) {
|
||||||
|
this.formData.disable();
|
||||||
|
} else {
|
||||||
|
this.formData.enable();
|
||||||
|
}
|
||||||
|
|
||||||
this.route.parent.parent.params.subscribe(async (params) => {
|
this.route.parent.parent.params.subscribe(async (params) => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
this.canManageBilling = (
|
this.canManageBilling = (
|
||||||
@@ -68,6 +84,13 @@ export class AccountComponent {
|
|||||||
try {
|
try {
|
||||||
this.org = await this.apiService.getOrganization(this.organizationId);
|
this.org = await this.apiService.getOrganization(this.organizationId);
|
||||||
this.canUseApi = this.org.useApi;
|
this.canUseApi = this.org.useApi;
|
||||||
|
|
||||||
|
this.formData.setValue({
|
||||||
|
name: this.org.name,
|
||||||
|
billingEmail: this.org.billingEmail,
|
||||||
|
businessName: this.org.businessName,
|
||||||
|
identifier: this.org.identifier,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
@@ -76,12 +99,19 @@ export class AccountComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
this.formData.markAllAsTouched();
|
||||||
|
this.showErrorSummary = true;
|
||||||
|
|
||||||
|
if (!this.formData.valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const request = new OrganizationUpdateRequest();
|
const request = new OrganizationUpdateRequest();
|
||||||
request.name = this.org.name;
|
request.name = this.formData.get("name").value;
|
||||||
request.businessName = this.org.businessName;
|
request.businessName = this.formData.get("businessName").value;
|
||||||
request.billingEmail = this.org.billingEmail;
|
request.billingEmail = this.formData.get("billingEmail").value;
|
||||||
request.identifier = this.org.identifier;
|
request.identifier = this.formData.get("identifier").value;
|
||||||
|
|
||||||
// Backfill pub/priv key if necessary
|
// Backfill pub/priv key if necessary
|
||||||
if (!this.org.hasPublicAndPrivateKeys) {
|
if (!this.org.hasPublicAndPrivateKeys) {
|
||||||
|
|||||||
@@ -5066,5 +5066,20 @@
|
|||||||
},
|
},
|
||||||
"apiAccessToken": {
|
"apiAccessToken": {
|
||||||
"message": "API Access Token"
|
"message": "API Access Token"
|
||||||
|
},
|
||||||
|
"inputRequired": {
|
||||||
|
"message": "Input is required."
|
||||||
|
},
|
||||||
|
"inputEmail": {
|
||||||
|
"message": "Input is not an email-address."
|
||||||
|
},
|
||||||
|
"fieldsNeedAttention": {
|
||||||
|
"message": "$COUNT$ field(s) above need your attention.",
|
||||||
|
"placeholders": {
|
||||||
|
"count": {
|
||||||
|
"content": "$1",
|
||||||
|
"example": "4"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user