Beispiel #1
0
        private object RegisterUser(object arg)
        {
            var username = (string)Request.Form.Username;
            var password = (string)Request.Form.Password;
            var repeat   = (string)Request.Form.Repeat;
            var email    = (string)Request.Form.Email;

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password) || password != repeat)
            {
                return(Context.GetRedirect("~/login?repeatError=true"));
            }

            if (UserSetting.UsernameExists(username))
            {
                return(Context.GetRedirect("~/login?userNameExists=true"));
            }

            if (UserSetting.EmailExists(email))
            {
                return(Context.GetRedirect("~/login?emailExists=true"));
            }

            var userGuid = UserMapper.CreateUser(username, password, email);

            if (userGuid == null)
            {
                return(Context.GetRedirect("~/login?error=true&username="******"~/games"));
        }