public async Task ValidFormSubmitted(EditContext editContext) { authorization_result = null; email_validation_message = null; password_validation_message = null; LoginModel model = (LoginModel)editContext.Model; if (model.email == "" || model.email == null) { email_validation_message = Localizer.GetText("Required"); } if (model.password == "" || model.password == null) { password_validation_message = Localizer.GetText("Required"); } if (email_validation_message != null || password_validation_message != null) { return; } var security_result = await _security.Authenticate(loginModel.email, loginModel.password); if (security_result.Item1) { await ProtectedSessionStore.SetAsync("GUID", security_result.Item2); var Locale = await ProtectedLocalStorage.GetAsync <string>("Culture"); if (Locale != null && Locale != "Select Culture") { LocOptions.Value.SetDefaultCulture(Locale); } navigationManager.NavigateTo("/main", forceLoad: true); } else { authorization_result = Localizer.GetText("WrongPassword"); loginModel.email = null; loginModel.password = null; } }
public async void setSessionID(string sessionState) { ProtectedSessionStore.SetAsync("session", sessionState).ConfigureAwait(false); }
async void saveSessionState(string session) { await ProtectedSessionStore.SetAsync("session", session); }
async void IncrementCount() { currentCount++; await ProtectedSessionStore.SetAsync("count", currentCount); }