Fixed: InvalidCredentials Alert

This commit is contained in:
TheJoKlLa 2023-01-19 01:31:07 +01:00
parent fbf249c54e
commit 85ae6767ae
5 changed files with 72 additions and 18 deletions

View File

@ -79,6 +79,12 @@ namespace Borepin.PageModel.AddServerProcess
public async Task AuthenticateCommandExecute()
{
IsBusy = true;
if(Username == null || Username == String.Empty || Password == null || Password == String.Empty)
{
IsBusy = false;
return;
}
Username = Username.Trim();
_ConnectionData = new ConnectionData()
@ -116,6 +122,16 @@ namespace Borepin.PageModel.AddServerProcess
});
return;
}
catch (InvalidCredentialsException)
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
IsBusy = false;
});
return;
}
catch (AuthenticationFailedException)
{
Device.BeginInvokeOnMainThread(async () =>
@ -126,7 +142,7 @@ namespace Borepin.PageModel.AddServerProcess
});
return;
}
catch(Exception)
catch(Exception ex)
{
Device.BeginInvokeOnMainThread(async () =>
{

View File

@ -109,7 +109,7 @@ namespace Borepin.PageModel
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT, Resources.Text.TextResource.Alert_QRInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT, Resources.Text.TextResource.ALERT_QRInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
IsScanning = true;
});
return;

View File

@ -69,23 +69,37 @@ namespace Borepin.PageModel
}
});
}
catch(Exception ex)
catch (ConnectingFailedException)
{
if (ex is AuthenticationFailedException)
Device.BeginInvokeOnMainThread(async () =>
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
else if (ex is ConnectingFailedException)
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
catch (AuthenticationFailedException)
{
Device.BeginInvokeOnMainThread(async () =>
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
catch (InvalidCredentialsException)
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
catch (Exception)
{
Device.BeginInvokeOnMainThread(async () =>
{
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
});
}
if (_API.IsConnected == false)
{
Device.BeginInvokeOnMainThread(async () =>
{
INavigationResult result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/ServerListPage").ConfigureAwait(false);

View File

@ -188,6 +188,15 @@ namespace Borepin.Resources.Text {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Credentials are invalid. ähnelt.
/// </summary>
internal static string ALERT_CredentialsInvalid {
get {
return ResourceManager.GetString("ALERT_CredentialsInvalid", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Connection already exist. Please delete old Connection before adding the new Connection. ähnelt.
/// </summary>
@ -209,9 +218,9 @@ namespace Borepin.Resources.Text {
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die QR Code is invalid ähnelt.
/// </summary>
internal static string Alert_QRInvalid {
internal static string ALERT_QRInvalid {
get {
return ResourceManager.GetString("Alert_QRInvalid", resourceCulture);
return ResourceManager.GetString("ALERT_QRInvalid", resourceCulture);
}
}
@ -450,6 +459,15 @@ namespace Borepin.Resources.Text {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Unlock ähnelt.
/// </summary>
internal static string MachinePage_Unlock {
get {
return ResourceManager.GetString("MachinePage_Unlock", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Use ähnelt.
/// </summary>

View File

@ -161,13 +161,16 @@ You can also put down several servers and then connect to the desired server.</v
<data name="ALERT_ConnectionFailed" xml:space="preserve">
<value>Connection failed</value>
</data>
<data name="ALERT_CredentialsInvalid" xml:space="preserve">
<value>Credentials are invalid.</value>
</data>
<data name="ALERT_DuplicateConnection" xml:space="preserve">
<value>Connection already exist. Please delete old Connection before adding the new Connection.</value>
</data>
<data name="ALERT_PasswordInvalid" xml:space="preserve">
<value>Password is invalid.</value>
</data>
<data name="Alert_QRInvalid" xml:space="preserve">
<data name="ALERT_QRInvalid" xml:space="preserve">
<value>QR Code is invalid</value>
</data>
<data name="ALERT_UnableServer" xml:space="preserve">
@ -249,6 +252,9 @@ Ask in your Space if you can be trained on the machine to be unlocked for the ma
<data name="MachinePage_OpenWiki" xml:space="preserve">
<value>Open Wiki</value>
</data>
<data name="MachinePage_Unlock" xml:space="preserve">
<value>Unlock</value>
</data>
<data name="MachinePage_Use" xml:space="preserve">
<value>Use</value>
</data>