adding forbidden and expired creds handling
This commit is contained in:
parent
1cda3fe182
commit
054b63c292
@ -45,6 +45,9 @@
|
||||
case SelectorNetClient.TokenResponseStatus.BadCreds:
|
||||
toast = "Login failed, try again";
|
||||
break;
|
||||
case SelectorNetClient.TokenResponseStatus.ExpiredCreds:
|
||||
toast = "Credentials expired, try again";
|
||||
break;
|
||||
case SelectorNetClient.TokenResponseStatus.OK:
|
||||
logger.LogInformation("Login succeeded, redirecting");
|
||||
navigation.NavigateTo("/app");
|
||||
|
@ -36,7 +36,7 @@ public class SelectorNetClient : ISelectorNetClient
|
||||
// _baseUrl = "https://selector.sarsoo.xyz";
|
||||
//}
|
||||
|
||||
//_baseUrl = "http://localhost:5000";
|
||||
// _baseUrl = "http://localhost:5000";
|
||||
_baseUrl = "https://selector.sarsoo.xyz";
|
||||
}
|
||||
|
||||
@ -81,6 +81,9 @@ public class SelectorNetClient : ISelectorNetClient
|
||||
case HttpStatusCode.Unauthorized:
|
||||
ret.Status = TokenResponseStatus.BadCreds;
|
||||
break;
|
||||
case HttpStatusCode.Forbidden:
|
||||
ret.Status = TokenResponseStatus.ExpiredCreds;
|
||||
break;
|
||||
case HttpStatusCode.OK:
|
||||
ret.Status = TokenResponseStatus.OK;
|
||||
ret.Token = result.Content.ReadFromJsonAsync<TokenNetworkResponse>().Result.Token;
|
||||
@ -107,7 +110,7 @@ public class SelectorNetClient : ISelectorNetClient
|
||||
|
||||
public enum TokenResponseStatus
|
||||
{
|
||||
Malformed, UserSearchFailed, BadCreds, OK
|
||||
Malformed, UserSearchFailed, BadCreds, ExpiredCreds, OK
|
||||
}
|
||||
|
||||
private class TokenModel
|
||||
|
@ -70,6 +70,14 @@ public class SessionManager
|
||||
case SelectorNetClient.TokenResponseStatus.UserSearchFailed:
|
||||
_logger.LogInformation("Token request failed, no user by that name");
|
||||
|
||||
break;
|
||||
case SelectorNetClient.TokenResponseStatus.ExpiredCreds:
|
||||
_logger.LogInformation("Token expired, log back in");
|
||||
lastStoredKey = null;
|
||||
lastRefresh = DateTime.Now;
|
||||
|
||||
Preferences.Default.Remove(Constants.JwtPrefKey);
|
||||
|
||||
break;
|
||||
case SelectorNetClient.TokenResponseStatus.BadCreds:
|
||||
_logger.LogInformation("Token request failed, bad password");
|
||||
|
Loading…
Reference in New Issue
Block a user