File

core/user/user-edit.component.ts

Implements

OnInit

Metadata

selector c8y-user-edit
templateUrl ./user-edit.component.html

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(state: AppStateService, translate: TranslateService, passwordService: PasswordService, modalConfirmService: ModalService, bsModalService: BsModalService, alert: AlertService, userService: UserService, tenantLoginOptionsService: TenantLoginOptionsService, tenantService: TenantService, userPreferencesService: UserPreferencesService)
Parameters :
Name Type Optional
state AppStateService No
translate TranslateService No
passwordService PasswordService No
modalConfirmService ModalService No
bsModalService BsModalService No
alert AlertService No
userService UserService No
tenantLoginOptionsService TenantLoginOptionsService No
tenantService TenantService No
userPreferencesService UserPreferencesService No

Inputs

isUsageTrackingEnabled

Type : boolean

Default value : true

lang

Type : string

loading

Type : boolean

Default value : false

showProductUsageSetting

Type : boolean

Default value : false

user

Outputs

onCancel $event Type: EventEmitter<void>
onLanguage $event Type: EventEmitter<string>
onProductExperience $event Type: EventEmitter<boolean>
onUser $event Type: EventEmitter<User>

Methods

cancel
cancel()
Returns : void
Async ngOnInit
ngOnInit()
Returns : any
onNewPasswordChanged
onNewPasswordChanged(newPassword: NewPassword)
Parameters :
Name Type Optional
newPassword NewPassword No
Returns : void
Async save
save()
Returns : any
setupTotp
setupTotp()
Returns : void

Properties

isPhoneRequired
isPhoneRequired:
Default value : false
isTfaEnabled
isTfaEnabled: boolean
Type : boolean
Public modalConfirmService
modalConfirmService: ModalService
Type : ModalService
Public passwordService
passwordService: PasswordService
Type : PasswordService
Public state
state: AppStateService
Type : AppStateService
Public translate
translate: TranslateService
Type : TranslateService
userCanSetupTotp
userCanSetupTotp:
Default value : false
userHasActiveTotp
userHasActiveTotp:
Default value : false
userIsExternal
userIsExternal: boolean
Type : boolean

Accessors

user
getuser()
setuser(u)
Parameters :
Name Optional
u No
Returns : void
langs
getlangs()
<form #userForm="ngForm" (ngSubmit)="userForm.form.valid && save()">
  <div class="alert alert-warning" role="alert" *ngIf="userIsExternal" translate>
    Some of the user settings are not editable here because they are managed via your authorization
    server.
  </div>
  <c8y-form-group>
    <label translate for="userName">Username (e.g. email)</label>
    <input
      id="userName"
      class="form-control"
      [(ngModel)]="user.userName"
      name="userName"
      autocomplete="off"
      required
      maxlength="254"
      placeholder="{{ 'e.g. joe.doe@example.com`LOCALIZE`' | translate }}"
      [disabled]="user.id"
      c8yDefaultValidation="user"
    />
  </c8y-form-group>

  <c8y-form-group>
    <label translate for="displayName">Login alias</label>
    <input
      id="displayName"
      class="form-control"
      [(ngModel)]="user.displayName"
      name="displayName"
      autocomplete="off"
      maxlength="254"
      placeholder="{{ 'e.g. joe.doe`LOCALIZE`' | translate }}"
      [disabled]="userIsExternal"
      c8yDefaultValidation="loginAlias"
    />
  </c8y-form-group>

  <c8y-form-group [hasWarning]="!user.email">
    <label translate for="userEmail">Email</label>
    <input
      id="userEmail"
      class="form-control"
      type="email"
      name="email"
      [maxlength]="254"
      autocomplete="off"
      placeholder="{{ 'e.g. joe.doe@example.com`LOCALIZE`' | translate }}"
      [(ngModel)]="user.email"
      email
      [required]="true"
      [disabled]="userIsExternal"
    />
  </c8y-form-group>

  <div class="row" style="margin-left:-15px; margin-right:-15px">
    <div class="col-sm-6">
      <c8y-form-group>
        <label translate for="userFirstName">First name</label>
        <input
          id="userFirstName"
          class="form-control"
          autocomplete="off"
          maxlength="50"
          name="firstName"
          [(ngModel)]="user.firstName"
          [disabled]="userIsExternal"
        />
      </c8y-form-group>
    </div>
    <div class="col-sm-6">
      <c8y-form-group>
        <label translate for="userLastName">Last name</label>
        <input
          id="userLastName"
          class="form-control"
          autocomplete="off"
          maxlength="50"
          name="lastName"
          [(ngModel)]="user.lastName"
          [disabled]="userIsExternal"
        />
      </c8y-form-group>
    </div>
  </div>

  <c8y-form-group>
    <label translate for="userTelephone">Telephone</label>
    <input
      id="userTelephone"
      class="form-control"
      autocomplete="off"
      name="phone"
      maxlength="254"
      [(ngModel)]="user.phone"
      placeholder="{{ 'e.g. +49 9 876 543 210`LOCALIZE`' | translate }}"
      c8yPhoneValidation
      c8yDefaultValidation="phoneNumber"
      [required]="isPhoneRequired"
      [disabled]="userIsExternal"
    />
  </c8y-form-group>

  <c8y-form-group>
    <label translate for="userLang">Language</label>
    <div class="c8y-select-wrapper">
      <select
        id="userLang"
        class="form-control"
        #selectLang
        name="lang"
        [(ngModel)]="lang"
        (change)="onLanguage.emit(selectLang.value)"
      >
        <option *ngFor="let lang of langs" [value]="lang">{{
          translate.getNativeLanguage(lang)
        }}</option>
      </select>
      <span></span>
    </div>
  </c8y-form-group>

  <c8y-form-group class="p-t-8 p-b-8 separator-top" *ngIf="showProductUsageSetting">
    <strong translate>Product experience</strong>
    <label class="c8y-switch" for="productUsageTracking">
      <input
        id="productUsageTracking"
        name="productUsageTracking"
        type="checkbox"
        [(ngModel)]="isUsageTrackingEnabled"
      />
      <span></span>
      {{ 'Enable anonymous tracking to enhance the product experience' | translate }}
    </label>
  </c8y-form-group>

  <div class="form-group" *ngIf="!userIsExternal">
    <label class="control-label">{{ 'Login options' | translate }}</label>
    <c8y-new-password (password)="onNewPasswordChanged($event)"></c8y-new-password>
    <button
      title="{{ 'Set up two-factor authentication' | translate }}"
      class="btn btn-default"
      type="button"
      (click)="setupTotp()"
      *ngIf="userCanSetupTotp && !userHasActiveTotp && isTfaEnabled"
    >
      {{ 'Set up two-factor authentication' | translate }}
    </button>
  </div>

  <c8y-form-group *ngIf="!!(state.state$ | async).newsletter">
    <label translate>Newsletter</label>
    <label
      title="{{ 'Send me information about outages, maintenance or updates.' | translate }}"
      class="c8y-checkbox"
    >
      <input
        type="checkbox"
        name="newsletter"
        [(ngModel)]="user.newsletter"
        [disabled]="userIsExternal"
      />
      <span></span>
      <span>
        {{ 'Send me information about outages, maintenance or updates.' | translate }}
      </span>
    </label>
  </c8y-form-group>

  <div class="modal-footer">
    <button
      title="{{ 'Cancel' | translate }}"
      class="btn btn-default"
      type="button"
      (click)="cancel()"
    >
      {{ 'Cancel' | translate }}
    </button>
    <button
      title="{{ 'Save' | translate }}"
      class="btn btn-primary"
      type="submit"
      [disabled]="!userForm.form.valid || userForm.form.pristine || loading"
    >
      {{ 'Save' | translate }}
    </button>
  </div>
</form>

result-matching ""

    No results matching ""