Various
Login auch im Testmodus Bei falschem Token nur eine Meldung Exception bei falschem Token während Loadsettings abfangen
This commit is contained in:
@@ -1,14 +1,5 @@
|
||||
using System;
|
||||
using Jugenddienst_Stunden.Models;
|
||||
using Jugenddienst_Stunden.ViewModels;
|
||||
using Microsoft.Maui.Controls;
|
||||
using System.Collections.Generic;
|
||||
using ZXing.Net.Maui;
|
||||
using Microsoft.Maui.Devices;
|
||||
using static Microsoft.Maui.ApplicationModel.Permissions;
|
||||
using ZXing.Net.Maui.Controls;
|
||||
using ZXing.QrCode.Internal;
|
||||
using System.Linq;
|
||||
|
||||
namespace Jugenddienst_Stunden.Views;
|
||||
|
||||
@@ -19,12 +10,13 @@ public partial class LoginPage : ContentPage {
|
||||
|
||||
private DateTime _lastDetectionTime;
|
||||
private readonly TimeSpan _detectionInterval = TimeSpan.FromSeconds(5);
|
||||
private bool hasCamera = false;
|
||||
|
||||
/// <summary>
|
||||
/// CTOR
|
||||
/// </summary>
|
||||
public LoginPage() {
|
||||
internal HoursBase HoursBase = new HoursBase();
|
||||
|
||||
/// <summary>
|
||||
/// CTOR
|
||||
/// </summary>
|
||||
public LoginPage() {
|
||||
InitializeComponent();
|
||||
|
||||
//if (BindingContext is LoginViewModel vm) {
|
||||
@@ -55,11 +47,13 @@ public partial class LoginPage : ContentPage {
|
||||
|
||||
try {
|
||||
var tokendata = new TokenData(barcode.Value);
|
||||
var op = await Models.HoursBase.LoadOperator(barcode.Value);
|
||||
Models.HoursBase.apiKey = barcode.Value;
|
||||
Models.HoursBase.name = op.name;
|
||||
Models.HoursBase.surname = op.surname;
|
||||
Models.HoursBase.EmployeeId = int.Parse(op.id);
|
||||
HoursBase.tokendata = tokendata;
|
||||
|
||||
var op = await HoursBase.LoadOperator(barcode.Value);
|
||||
HoursBase.apiKey = barcode.Value;
|
||||
HoursBase.name = op.name;
|
||||
HoursBase.surname = op.surname;
|
||||
HoursBase.EmployeeId = int.Parse(op.id);
|
||||
Title = op.name + " " + op.surname;
|
||||
ServerLabel.Text = "Server: " + tokendata.Url.Replace("/appapi", "").Replace("https://", "").Replace("http://", "");
|
||||
|
||||
@@ -125,11 +119,11 @@ public partial class LoginPage : ContentPage {
|
||||
Types.User response = await BaseFunc.AuthUserPass(username, password, server);
|
||||
|
||||
var tokendata = new TokenData(response.Token);
|
||||
var op = await Models.HoursBase.LoadOperator(response.Token);
|
||||
Models.HoursBase.apiKey = response.Token;
|
||||
Models.HoursBase.name = op.name;
|
||||
Models.HoursBase.surname = op.surname;
|
||||
Models.HoursBase.EmployeeId = int.Parse(op.id);
|
||||
var op = await HoursBase.LoadOperator(response.Token);
|
||||
HoursBase.apiKey = response.Token;
|
||||
HoursBase.name = op.name;
|
||||
HoursBase.surname = op.surname;
|
||||
HoursBase.EmployeeId = int.Parse(op.id);
|
||||
Title = op.name + " " + op.surname;
|
||||
ServerLabel.Text = "Server: " + tokendata.Url.Replace("/appapi", "").Replace("https://", "").Replace("http://", "");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user