Commit 699729cd authored by Emily Jensen's avatar Emily Jensen

Added errors

parent 72abfd77
......@@ -23,6 +23,8 @@ export class ResetPasswordVerifyComponent implements OnInit {
hasStarted: boolean;
@Input()
errorMessage: string;
@Input()
cameraError: string | null;
@Output()
verify = new EventEmitter<string>();
......@@ -63,7 +65,10 @@ export class ResetPasswordVerifyComponent implements OnInit {
requestAnimationFrame(this.tick);
this.videoBootstrapped = true;
})
.catch(err => console.log(err));
.catch(err => {
this.cameraError = "Unable to initialize the camera. Try typing the backup code in the text field below instead.";
this.toggleScan();
});
} else {
requestAnimationFrame(this.tick);
this.video.play();
......@@ -71,8 +76,8 @@ export class ResetPasswordVerifyComponent implements OnInit {
}
handleQrFound = (content: string) => {
this.verify.emit(content);
};
this.verify.emit(content);
}
onSubmit() {
if (this.form.isValid) {
......@@ -110,9 +115,9 @@ export class ResetPasswordVerifyComponent implements OnInit {
const code = jsQR(imageData.data, imageData.width, imageData.height);
if (code) {
this.handleQrFound(code.data);
}
}
}
requestAnimationFrame(this.tick);
}
};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment