public bool SaveUser(UserClientModel uc)
        {
            //MAppers
            UserClientEntity ue = new UserClientEntity();

            ue.Nom      = uc.Nom;
            ue.Prenom   = uc.Prenom;
            ue.Email    = uc.Email;
            ue.Login    = uc.Login;
            ue.Password = uc.Password;

            return(_userRepository.Insert(ue));
        }
Beispiel #2
0
        public UserClientModel GetUserData()
        {
            int id = Convert.ToInt32(Request.Cookies["userId"]);

            _logger.LogInformation("Got user id : " + id.ToString());

            UsersModel fromDb = usersRep.GetUser(id);

            KeyAndVectorModel kav = keyAndVectorRep.GetKeyAndVector();

            UserClientModel toClient = new UserClientModel();

            toClient.Email      = fromDb.Email;
            toClient.Role       = fromDb.Role;
            toClient.UserName   = fromDb.UserName;
            toClient.FirstName  = AesEncrDecr.DecryptStringFromBytes_Aes(fromDb.FirstName, kav.key, kav.iv);
            toClient.SecondName = AesEncrDecr.DecryptStringFromBytes_Aes(fromDb.SecondName, kav.key, kav.iv);
            toClient.BirthDate  = AesEncrDecr.DecryptStringFromBytes_Aes(fromDb.BirthDate, kav.key, kav.iv);

            return(toClient);
        }
 public ActionResult Login(LoginModel lm)
 {
     if (ModelState.IsValid)
     {
         UserClientModel um = ctx.UserAuth(lm);
         if (um == null)
         {
             ViewBag.Error = "Erreur Login/Password";
             return(View());
         }
         else
         {
             SessionUtil.IsLogged            = true;
             SessionUtil.ConnectedUserClient = um;
             return(RedirectToAction("Index", "Home", new { area = "Membre" }));
         }
     }
     else
     {
         return(View());
     }
 }