Esempio n. 1
0
        public ActionResult LostPassword(string email)
        {
            var rep = GetRepository<User>();
            var user = new User();
            //TODO: Check is valid Email
            user = rep.All().AsQueryable().GetUserByEmail(email);

            if (user != null)
            {
                //send email
                var EmailSuccessful = EmailBuilder.SendRecoverPasswordEmail(user);
                if (EmailSuccessful)
                {
                    //Give message saying email has been sent!
                    return new JsonResult { Data = new { Validation = HelpersTypes.LostPasswordValidation.Successful } };
                }
                return new JsonResult { Data = new { Validation = HelpersTypes.LostPasswordValidation.EmailNotSent } };

            }
            //Validation failed return error message!!!
            return new JsonResult { Data = new { Validation = HelpersTypes.LostPasswordValidation.UserNotFound } };
        }
Esempio n. 2
0
        public User CreatePlayer(League playersleague)
        {
            //create users first
            var newUser = new User
            {
                Email = Email,
                Password = Password,
                Live = true,
                Created = SystemDate.Current(),
                Updated = SystemDate.Current(),
                ActivationCode = GetHashCode()
            };

             //create the player next
            var newPlayer = new Player
            {
                Name = Username,
                User = newUser
            };

            //add player to the league
            playersleague.Players.Add(newPlayer);

            return newUser;
        }