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;IAL5B,wDAAS,CAAC;QACT,QAAQ,EAAE,mBAAmB;QAC7B,oJAAwC;;KAEzC,CAAC;GACW,gBAAgB,CAqF5B;AArF4B;;;;;;;;;;;;;;;ACX7B,iEAAe,mTAAmT,kBAAkB,mBAAmB,wLAAwL,iBAAiB,6PAA6P,cAAc,01BAA01B,inCAAinC","sources":["./src/app/pages/authorise-key/authorise-key-routing.module.ts","./src/app/pages/authorise-key/authorise-key.module.ts","./src/app/pages/authorise-key/authorise-key.page.ts","./src/app/pages/authorise-key/authorise-key.page.html"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nimport { AuthoriseKeyPage } from './authorise-key.page';\n\nconst routes: Routes = [\n {\n path: '',\n component: AuthoriseKeyPage\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class AuthoriseKeyPageRoutingModule {}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { IonicModule } from '@ionic/angular';\n\nimport { AuthoriseKeyPageRoutingModule } from './authorise-key-routing.module';\n\nimport { AuthoriseKeyPage } from './authorise-key.page';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n IonicModule,\n AuthoriseKeyPageRoutingModule\n ],\n declarations: [AuthoriseKeyPage]\n})\nexport class AuthoriseKeyPageModule {}\n","import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\n\nimport { SettingsService } from 'src/app/services/settings.service';\nimport { UpdateService } from 'src/app/services/update.service';\n\n@Component({\n selector: 'app-authorise-key',\n templateUrl: './authorise-key.page.html',\n styleUrls: ['./authorise-key.page.scss'],\n})\nexport class AuthoriseKeyPage implements OnInit {\n activationEmail: string='';\n errorMessage: string = '';\n errorReturned: boolean=false;\n mainForm: boolean=true;\n finalScreen: boolean=false;\n credentialsForm: FormGroup = new FormGroup({});\n networkConnected: boolean=true;\n authorised: boolean=true;\n authenticated: boolean=false;\n result: any = {\"Success\":false, \"Message\":\"\", \"Data\":{}};\n\n constructor(\n private formBuilder: FormBuilder,\n public settings: SettingsService,\n private update: UpdateService\n ) { \n this.settings.log(1,'AuhoriseKeyPage constructor start');\n this.activationEmail = this.settings.currentActivationEmail;\n this.credentialsForm = this.formBuilder.group({\n key: ['', Validators.required]\n }); \n\n // we need to watch for changing network status \n this.settings.platform.ready().then(() => {\n this.networkConnected = this.settings.isConnected();\n this.mainForm = this.networkConnected;\n this.settings.configureMatomoAndFirebase();\n if (!this.networkConnected) {\n this.finalScreen = false;\n }\n });\n this.settings.userAuthorised().then((authorised:boolean)=>{\n this.authorised = authorised; \n this.authenticated = this.settings.userAuthenticated;\n }); \n }\n\n ngOnInit() {\n this.settings.log(1,'ngOnInit AuthoriseKeyPage');\n this.settings.trackPageView('Activate With Key'); \n }\n\n authoriseKey() {\n this.errorMessage = 'Validating key. Please wait ...';\n this.errorReturned = true; \n let commandParameters = 'pub=' + this.credentialsForm.controls['key'].value.toUpperCase() + \n '&pri=' + this.settings.currentPrivateKey;\n this.settings.executeCommand('authorisewithkey', commandParameters)\n .subscribe(result => { \n this.result = result;\n this.settings.log(1,'authoriseKey http post result=' + JSON.stringify(this.result));\n if (this.result.Success) {\n if (this.settings.currentAppData && this.settings.currentAppData.Username) {\n this.settings.trackMatomoEvent(\"Management\", \"Activate\", \"App Activated (Reactivate)\", null);\n } else {\n this.settings.trackMatomoEvent(\"Management\", \"Activate\", \"App Activated (Initial)\", null);\n }\n this.settings.log(1,\"before authoriseUser: this.result.Data.firstname=\" + this.result.Data.firstname);\n this.settings.authoriseUser(this.result.Data.cryptokey, this.result.Data.usertoken, this.result.Data.deviceid, this.update);\n this.settings.currentCryptoKey = this.result.Data.cryptokey;\n // check for updates after autorisation - GR That happens from authoriseUser now (2020-04-13) !\n // this.update.checkAppUpdatesInBackground(); \n // GR this.settings.userAuthenticated will be set to true by authoriseUser so logic below doesn't make sense\n this.mainForm = false;\n\n this.settings.updateCurrentUserData(result); \n //}\n this.settings.openPage('AuthoriseAddPinPage');\n\n } else {\n // display error message\n this.settings.trackMatomoEvent(\"Management\", \"Activate\", \"App Activation - Step 2 KEY Activation Failure\", null);\n this.errorReturned = true;\n this.errorMessage = this.result.Message;\n this.settings.log(2,'authoriseKey error message=' + this.result.Message);\n }\n }, error => {\n this.settings.trackMatomoEvent(\"Management\", \"Activate\", \"App Activation - Step 2 KEY Activation Failure 2\", null);\n this.settings.log(2,'authoriseKey authorise server error ' + JSON.stringify(error));\n this.result.Message = \"Error connecting to the site\";\n this.errorReturned = true;\n this.errorMessage = this.result.Message;\n });\n } \n}\n","export default \"<ion-header>\\n <ion-toolbar color=\\\"tertiary\\\">\\n <ion-title>Activate App With Key</ion-title>\\n </ion-toolbar>\\n</ion-header>\\n\\n<ion-content class=\\\"ion-padding partialWidth\\\">\\n \\n <ion-row>\\n <ion-col class=\\\"ion-text-center\\\">\\n <img src=\\\"./assets/imgs/logo.png\\\" style=\\\"width: 100%; max-width: 300px; margin-bottom: 5em;\\\">\\n </ion-col>\\n </ion-row> \\n\\n <div *ngIf=\\\"mainForm\\\">\\n <p class=\\\"ion-text-center\\\">We've emailed an activation code to \\n <span class=\\\"emailUnlinked\\\">{{activationEmail}}</span>. \\n </p>\\n <p class=\\\"ion-text-center\\\">\\n Check your email, then type the code below to activate the app. The code will expire in 1 hour.</p>\\n\\n <div *ngIf=\\\"errorReturned && errorMessage != ''\\\"><ion-label class=\\\"error\\\">{{errorMessage}}</ion-label></div>\\n\\n <form [formGroup]=\\\"credentialsForm\\\">\\n\\n <ion-item>\\n <ion-label position=\\\"floating\\\">Key</ion-label>\\n <ion-input formControlName=\\\"key\\\" autocapitalize=\\\"characters\\\"\\n type=\\\"text\\\"></ion-input>\\n </ion-item> \\n\\n <ion-row class=\\\"sign-in-button-container\\\">\\n <ion-col class=\\\"ion-text-center\\\">\\n <ion-button expand=\\\"block\\\" color=\\\"primary\\\"\\n [disabled]=\\\"!credentialsForm.valid\\\" (click)=\\\"authoriseKey()\\\">\\n Activate\\n </ion-button>\\n </ion-col>\\n </ion-row>\\n \\n </form>\\n\\n \\n <br>\\n <div class=\\\"ion-text-center\\\">\\n Email not arriving? (It can take several minutes.)\\n <ion-button class=\\\"textBlockButton ion-text-center\\\" style=\\\"text-decoration: underline;\\\" fill=\\\"clear\\\" expand=\\\"block\\\" (click)=\\\"this.settings.openPage('AuthoriseEmailPage')\\\">\\n Send a new code\\n </ion-button>\\n </div>\\n\\n </div>\\n\\n <div *ngIf=\\\"!networkConnected\\\">\\n <div>To authorise access to this application an internet connection is required.\\n Please make sure that either wifi or data connection is available.\\n </div>\\n </div>\\n\\n <div *ngIf=\\\"finalScreen\\\">\\n <div>You are authorised to use this application.</div> \\n\\n <div>Note that you need to set PIN to access app on this device later.</div>\\n\\n <ion-button fill=\\\"clear\\\" color=\\\"dark\\\" (click)=\\\"this.settings.openPage('AuthoriseAddPinPage')\\\">\\n Set PIN\\n </ion-button> \\n <ion-button fill=\\\"clear\\\" color=\\\"dark\\\" (click)=\\\"this.settings.openPage('HomePage')\\\">\\n Go to dashboard\\n </ion-button>\\n </div>\\n\\n\\n<ion-row class=\\\"ion-text-center\\\">\\n <ion-col>\\n <hr>\\n <p class=\\\"small\\\">\\n By using this app you agree to the\\n <a (click)=\\\"this.settings.openPage('TermsAndConditionsPage')\\\">Terms and Conditions</a>.\\n </p>\\n </ion-col>\\n</ion-row>\\n\\n</ion-content>\\n\";"],"names":[],"sourceRoot":"webpack:///"}