internal static User CheckCachedUser(User userCandidate) { var userInStorage = GenericEntityWrapper.GetUserByName(userCandidate.Login); if (userInStorage != null && userInStorage.CheckPassword(userCandidate)) { return(userInStorage); } return(null); }
private async void SignUpExecute(object o) { LoaderManager.Instance.ShowLoader(); var result = await Task.Run(() => { User currentUser; try { // if (ApplicationStaticDB.GetUserByLogin(_login) != null) if (GenericEntityWrapper.GetUserByName(_login) != null) { MessageBox.Show("Try up new name! This user already exists: " + _login); return(false); } if (!IsValidEmail(_email)) { MessageBox.Show("Invalid e-mail: " + _email); return(false); } currentUser = new User(_name, _lastname, _email, _login, _password); //ApplicationStaticDB.AddUser(currentUser); try { GenericEntityWrapper.AddEntity <User>(currentUser); MessageBox.Show("added"); SessionContext.CurrentUser = currentUser; MessageBox.Show("currUser"); } catch (Exception e) { MessageBox.Show("" + e); } Logger.Log("User " + currentUser.Id + " signed up"); Serializer.Serialize(currentUser, StaticResources.StorageFilePath); return(true); } catch (Exception ex) { Logger.Log("Error , " + ex); return(false); } }); LoaderManager.Instance.HideLoader(); if (result) { NavManager.Instance.Navigate(ModesEnum.Main); } }
public User GetUserByName(string userName) { return(GenericEntityWrapper.GetUserByName(userName)); }