LoginFixes

This commit is contained in:
2025-12-18 15:35:39 +01:00
parent c11b361655
commit 5fd97deada
4 changed files with 177 additions and 173 deletions

View File

@@ -87,7 +87,7 @@ internal sealed class AuthService : IAuthService {
//}
if (url.EndsWith("/", StringComparison.Ordinal)) {
url = url.Remove(url.Length - 1, 1);
url = url.TrimEnd('/');
}
return url;
}

View File

@@ -33,6 +33,9 @@ public partial class LoginViewModel : ObservableObject {
[ObservableProperty]
private string? server;
[ObservableProperty]
private string? serverLabel;
[ObservableProperty]
private string title = Preferences.Default.Get("name", "Nicht") + " " + Preferences.Default.Get("surname", "eingeloggt");
@@ -67,7 +70,8 @@ public partial class LoginViewModel : ObservableObject {
// Serveranzeige vorbereiten
var apiUrl = Preferences.Default.Get("apiUrl", string.Empty);
if (!string.IsNullOrWhiteSpace(apiUrl)) {
Server = "Server: " + apiUrl.Replace("/appapi", "").Replace("https://", "").Replace("http://", "");
Server = apiUrl.Replace("/appapi", "").Replace("https://", "").Replace("http://", "");
ServerLabel = "Server: " + Server;
}
// Command initialisieren
@@ -95,7 +99,7 @@ public partial class LoginViewModel : ObservableObject {
IsBusy = true;
var user = await _auth.LoginWithCredentials(Username?.Trim() ?? string.Empty,
Password ?? string.Empty,
(Server ?? string.Empty).Replace("Server:", string.Empty).Trim());
(Server ?? string.Empty).Trim());
Title = $"{user.Name} {user.Surname}";
InfoEvent?.Invoke(this, "Login erfolgreich");

View File

@@ -44,7 +44,7 @@
</Grid>
</Grid>
<Label x:Name="ServerLabel" Text="{Binding Server}"
<Label x:Name="ServerLabel" Text="{Binding ServerLabel}"
IsVisible="{Binding Server, Converter={StaticResource StringVisibilityConverter}}" />
<VerticalStackLayout x:Name="LoginQR" Margin="0,20,0,0" IsVisible="{Binding IsManualMode, Converter={StaticResource InverseBoolConverter}}">