File

core/authentication/totp-challenge.component.ts

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(loginService: LoginService, users: UserService, alert: AlertService)
Parameters :
Name Type Optional
loginService LoginService No
users UserService No
alert AlertService No

Inputs

hasError
Type : boolean
Default value : false
loading
Type : boolean
Default value : false
verify
Type : boolean
Default value : true

Calls the verify endpoint if set to true (default true)

Outputs

onSuccess
Type : EventEmitter

Emits the token on success.

totpUnconfirmedEmitter
Type : EventEmitter

Emits if set up two-factor authentication is canceled.

Methods

cancel
cancel()
Returns : void
Async verifyCode
verifyCode()
Returns : any

Properties

Public loginService
Type : LoginService
model
Type : object
Default value : { token: '' }
<form #totpForm="ngForm" class="loginForm" (ngSubmit)="verifyCode()" novalidate>
  <div class="d-block p-24 p-b-0">
    <c8y-form-group
      [hasError]="hasError"
      [novalidation]="true"
      [ngClass]="hasError ? 'p-b-24' : ''"
    >
      <h1 class="label p-0"><label translate for="totpToken">Verification code</label></h1>

      <input
        id="totpToken"
        [(ngModel)]="model.token"
        name="totpToken"
        type="text"
        autofocus
        autocapitalize="off"
        autocorrect="off"
        autocomplete="off"
        class="form-control"
        placeholder="{{ 'e.g.' | translate }} 624327"
        required
      />

      <c8y-messages>
        <c8y-message *ngIf="hasError" translate>
          Invalid verification code. In case of key loss, contact your platform administrator.
        </c8y-message>
      </c8y-messages>
      <p id="helpinput" *ngIf="!hasError" class="help-block" translate>
        In case of key loss, please contact your platform administrator.
      </p>
    </c8y-form-group>
  </div>
  <div class="modal-footer separator-top bg-level-0 sticky-bottom p-b-0">
    <button
      title="{{ 'Cancel' | translate }}"
      class="btn btn-default"
      type="button"
      (click)="cancel()"
    >
      {{ 'Cancel' | translate }}
    </button>
    <button
      *ngIf="!loading"
      title="{{ 'Verify' | translate }}"
      [disabled]="!totpForm.form.valid"
      type="submit"
      class="btn btn-primary form-group"
    >
      {{ 'Verify' | translate }}
    </button>

    <button
      *ngIf="loading"
      title="{{ 'Verifying…' | translate }}"
      type="submit"
      class="btn btn-primary btn-pending"
    >
      {{ 'Verifying…' | translate }}
    </button>
  </div>
</form>

results matching ""

    No results matching ""