Beispiel #1
0
        public async Task <IHttpActionResult> Register(UserInscModel userInsc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (userInsc.response == null)
            {
                return(BadRequest("Captcha invalide !!"));
            }



            string EncodedResponse = userInsc.response;
            bool   IsCaptchaValid  = (ReCaptchaClass.Validate(EncodedResponse) == "True" ? true : false);

            if (!IsCaptchaValid)
            {
                return(BadRequest("Captcha invalide !!"));
            }
            User user = _UserService.getByEmailOrUsername(userInsc.Email, userInsc.UserName);

            if (user != null)
            {
                return(BadRequest("Email Adresse /Username existe already !!"));
            }

            _UserService.AddUser(userInsc);

            return(Ok());
        }
Beispiel #2
0
 public void AddUser(UserInscModel userIns)
 {
     _UserRepository.Insert(new User {
         Email = userIns.Email, Username = userIns.UserName, Password = userIns.Password, DateAdd = DateTime.Now
     });
     _UserRepository.Save();
 }