public bool CanRegisterConfirm() { if (string.IsNullOrEmpty(Pseudo) || StringChecker.HasSpaces(Pseudo)) { return(false); } if (!StringChecker.IsValidEmail(Email)) { return(false); } if (string.IsNullOrEmpty(Password) || StringChecker.HasSpaces(Password)) { return(false); } if (SelectedDepartement == null) { return(false); } if (EmailAlreadyExist()) { return(false); } if (PseudoAlreadyExist()) { return(false); } return(true); }
private void Login() { // for test purposes //MonthHelper.CreateMonth(DateTime.Now); string pass = ""; Guid Salt; User u = allUser.Where(x => x.Pseudo == Pseudo).FirstOrDefault(); if (u != null) { Salt = u.Salt; pass = PasswordHasher.Hash(Password, Salt); if (allUser.Where(x => x.Password == pass).FirstOrDefault() != null) { SessionManager.CurrentUser = u; //NE PAS TOUCHER !!!!!!!! AgendaViewModelCollection avm = AgendaViewModelCollection.Instance; avm.LoadEvent.Invoke(this, EventArgs.Empty); AgendaWindow window = new AgendaWindow { DataContext = avm }; //avm. = AgendaRepo.Instance.GetAll().Where(x => x.UserId == u.UserId).FirstOrDefault().AgendaId; //avm.Date = DateTime.Now; CloseWindow(); window.Show(); } else { Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "DontExist").FirstOrDefault().Value; } } else { Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "DontExist").FirstOrDefault().Value; if (string.IsNullOrEmpty(Pseudo)) { Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "Null").FirstOrDefault().Value; } if (StringChecker.HasSpaces(Pseudo)) { Warning = WarningUtils.ErrorCodes.Where(x => x.Key == "NoSpace").FirstOrDefault().Value; } } }