Exemplo n.º 1
0
        public ActionResult TotalCodeCasinoPageTemplate()
        {
            var model = GetModel <GamePageViewModel>(CurrentPage);

            if (Request.QueryString["gameId"] != null)
            {
                var origin        = TenantHelper.GetCurrentTenantUrl(contentService, model.TenantUid);
                var gameId        = int.Parse(Request.QueryString["gameId"].ToString());
                var key           = ApiKeyCache.GetByTenantUid(model.TenantUid);
                var authorization = GetAuthorization(key);
                var games         = apiService.GetGameDataAnonymousArray(model.TenantUid, origin, authorization: authorization.AccessToken);
                var game          = games.SingleOrDefault(x => x.GameId == gameId);
                if (game != null)
                {
                    model.HasDemoMode = game.DemoEnabled;
                    model.GameUrl     = game.Url;
                }
            }
            else
            {
                model.Slider = CurrentPage.Value <IEnumerable <IPublishedElement> >("gameSlider")
                               .Select(x => new SliderItem
                {
                    Image       = x.HasValue("sliderItemImage") ? x.GetProperty("sliderItemImage").Value <IPublishedContent>().Url : string.Empty,
                    ButtonLabel = x.HasValue("sliderItemButtonLabel") ? x.GetProperty("sliderItemButtonLabel").GetValue().ToString() : string.Empty,
                    Title       = x.HasValue("sliderItemTitle") ? x.GetProperty("sliderItemTitle").GetValue().ToString() : string.Empty,
                    Subtitle    = x.HasValue("sliderItemSubtitle") ? x.GetProperty("sliderItemSubtitle").GetValue().ToString() : string.Empty,
                    Url         = x.HasValue("sliderItemUrl") ? x.GetProperty("sliderItemUrl").GetValue().ToString() : string.Empty,
                })?.ToList();
            }

            model.Category = "casino";
            return(CurrentTemplate(model));
        }
        public async Task <JsonResult> EditCustomer(string tenantUid, string title, string firstname, string lastname, string gender, string day, string month, string year, string country, string countrycode, string timezone, string odds, string language, string username, string customerGuid, string customerToken, string address1 = "", string address2 = "", string address3 = "", string town = "", string county = "", string postalcode = "", string notify = "true")
        {
            var customer = new EditCustomer
            {
                Username = username,
                Fields   = new Models.EditCustomer.EditFields
                {
                    CountryCode         = countrycode,
                    DOB                 = !string.IsNullOrEmpty(day) ? $"{year}-{month}-{day}" : string.Empty,
                    FirstName           = firstname,
                    LastName            = lastname,
                    Gender              = gender,
                    LanguageCode        = language,
                    OddsDisplay         = odds,
                    TimeZoneCode        = timezone,
                    Title               = title,
                    AddressLine1        = address1,
                    AddressLine2        = address2,
                    AddressLine3        = address3,
                    County              = county,
                    Town                = town,
                    Country             = country,
                    PostCode            = postalcode,
                    NotificationComPref = notify
                }
            };
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.EditCustomerAsync(customer, tenantUid, origin, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> GetCustomerEmail(string tenantUid, string customerGuid)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = apiService.GetCustomerEmail(tenantUid, origin, customerGuid, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
        public async Task <JsonResult> ForgotUsernameEmail(string tenantUid, string email, string language)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await apiService.ForgotUsernameEmailAsync(tenantUid, origin, email, language, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 5
0
        public async Task <JsonResult> VerifyMobileValidateSMS(string tenantUid, string mobile, string code, string language)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await verificationService.ValidateSmsVerificationCodeAsync(tenantUid, origin, mobile, code, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> GetAccessToken(string tenantUid)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = authorization.AccessToken;

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> ChangePasswordViaSms(string tenantUid, string username, string code, string password)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await apiService.VerifyPasswordResetSmsAsync(tenantUid, origin, username, code, password, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> GetGameGrid(string tenantUid, string category = "", string subCategory = "", string provider = "", string keyword = "", string languageCode = "")
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await _gameService.GetGameDataAnonymousArrayAsync(tenantUid, origin, category, subCategory, provider, keyword, languageCode, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 9
0
 public TotalCodeGenericPageController(IContentService contentService)
 {
     this.contentService = contentService;
     this.apiService     = new TotalCodeApiService();
     using (var scope = ConnectorContext.ScopeProvider.CreateScope(autoComplete: true))
     {
         ApiKeyCache.UpdateCache(scope.Database);
     }
 }
Exemplo n.º 10
0
 public BaseController()
 {
     apiService     = new TotalCodeApiService();
     contentService = ConnectorContext.ContentService;
     using (var scope = ConnectorContext.ScopeProvider.CreateScope(autoComplete: true))
     {
         ApiKeyCache.UpdateCache(scope.Database);
     }
 }
        public async Task <JsonResult> LoginForm(string tenantUidForm, string credentialForm, string passwordForm, string rememberMe = "off")
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUidForm);
            var key           = ApiKeyCache.GetByTenantUid(tenantUidForm);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await apiService.LoginFormAsync(tenantUidForm, origin, credentialForm, passwordForm, rememberMe, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 12
0
        public async Task <JsonResult> VerifyEmailReSendCode(string tenantUid, string id, string email, string language)
        {
            var origin          = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key             = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization   = await new Authorization().GetAuthorizationAsync(key);
            var verificationUrl = helper.GetConfirmVerificationUrl(tenantUid, origin, email, language, id);
            var response        = await verificationService.VerificationEmailAsync(tenantUid.ToString(), origin, verificationUrl, email, language, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
 public ConfirmEmailController(ILogger logger)
 {
     this.logger         = logger;
     verificationService = new TotalCodeApiService();
     helper = new Helpers.UrlHelper(Umbraco);
     using (var scope = ConnectorContext.ScopeProvider.CreateScope(autoComplete: true))
     {
         ApiKeyCache.UpdateCache(scope.Database);
     }
 }
Exemplo n.º 14
0
 public RegistrationController()
 {
     verificationService = new TotalCodeApiService();
     contentService      = ConnectorContext.ContentService;
     helper = new Helpers.UrlHelper(Umbraco);
     using (var scope = ConnectorContext.ScopeProvider.CreateScope(autoComplete: true))
     {
         ApiKeyCache.UpdateCache(scope.Database);
     }
 }
        public async Task <JsonResult> ForgotPasswordSendEmail(string tenantUid, string email, string username, string language, string requestUrl)
        {
            var origin          = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key             = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization   = await new Authorization().GetAuthorizationAsync(key);
            var verificationUrl = helper.GetResetPasswordVerificationUrl(tenantUid, requestUrl, username, language);
            var response        = await apiService.SendPasswordEmailAsync(tenantUid, origin, username, email, language, verificationUrl.ToString(), authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> ForgotUsernameSms(string tenantUid, string countryCode, string mobile, string language)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var mobileNumber  = $"{countryCode}{mobile}";
            var response      = await apiService.ForgotUsernameSmsAsync(tenantUid, origin, mobileNumber, language, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> CreateTicketAnonymous(CreateTicketAnonymousModel ticket, string tenantUid)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(_contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await _ticketService.CreateTicketAnonymous(tenantUid, authorization.AccessToken, origin, ticket);

            return(Json(response));
        }
        public async Task <JsonResult> GetCustomer(string tenantUid, string username, string customerToken)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.GetCustomerInfoAsync(tenantUid, origin, username, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 19
0
        public async Task <JsonResult> VerifyMobileSendSMS(string tenantUid, string countryCode, string mobile, string language)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var mobileNumber  = $"{countryCode}{mobile.TrimStart(new Char[] { '0' })}";
            var response      = await verificationService.VerifyMobileAsync(tenantUid.ToString(), origin, mobileNumber, language, authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
 public GameController(IGameService gameService)
 {
     _gameService        = gameService;
     this.apiService     = new TotalCodeApiService();
     this.contentService = ConnectorContext.ContentService;
     using (var scope = ConnectorContext.ScopeProvider.CreateScope(autoComplete: true))
     {
         ApiKeyCache.UpdateCache(scope.Database);
     }
 }
        public PurgeResults PurgeTenant(SimpleTenant tenant)
        {
            var contentService = ConnectorContext.ContentService;
            var userService    = ConnectorContext.UserService;
            var mediaService   = ConnectorContext.MediaService;

            var tenantNode = nodeHelper.GetTenantRoot(tenant.TenantUId);

            if (tenantNode == null)
            {
                throw new TenantException(ExceptionCode.TenantNotFound.CodeToString(), ExceptionCode.TenantNotFound, tenant.TenantUId);
            }

            var user  = userService.GetByUsername(tenant.Username);
            var group = user?.Groups.Any() == true?userService.GetUserGroupById(user.Groups.ToList()[0].Id) : userService.GetUserGroupByAlias(tenant.Group.Sanitize());

            var media = group != null?mediaService.GetById(group.StartMediaId.Value) : mediaService.GetByLevel(1).SingleOrDefault(x => x.Name.Equals(tenantNode.Name));

            if (user != null)
            {
                userGroupService.PurgeUserAfterFirstLogin(user.Id);
                userService.Delete(user, true);
            }

            if (group != null)
            {
                foreach (var u in userService.GetAllInGroup(group.Id))
                {
                    userService.Delete(u, true);
                }
                userService.DeleteUserGroup(group);
            }

            if (media != null)
            {
                mediaService.Delete(media);
            }
            if (tenantNode != null)
            {
                contentService.Delete(tenantNode);
            }

            new ApiKeysService(this.database).PurgeTenant(tenant.TenantUId.ToString()); // remove tenant's Api information
            ApiKeyCache.ForceUpdateCache(this.database);

            return(new PurgeResults
            {
                ContentFoundAndDeleted = tenantNode != null,
                GroupFoundAndDeleted = group != null,
                UserFoundAndDeleted = user != null,
                MediaFolderFoundAndDeleted = media != null
            });
        }
Exemplo n.º 22
0
        public async Task <JsonResult> VerifyEmailConfirm(string tenantUid, string email, string code, string verificationUrl, string language)
        {
            if (string.IsNullOrEmpty(email))
            {
                return(Json(new { response = "Conflict, email is missing" }, JsonRequestBehavior.DenyGet));
            }
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = await verificationService.ConfirmEmailAsync(tenantUid, origin, email, code, new Uri(verificationUrl).ToString(), authorization.AccessToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> EditMobileNumber(string tenantUid, string username, string customerToken, string mobile, string countryCode)
        {
            var newMobile = new EditMobileNumber
            {
                Username = LoginSession.Username,
                Mobile   = $"{countryCode}{mobile}"
            };
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.EditMobileAsync(newMobile, tenantUid, origin, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> UploadAnonymous(HttpPostedFileBase file, string tenantUid)
        {
            if (file.ContentLength > 0)
            {
                var origin        = TenantHelper.GetCurrentTenantUrl(_contentService, tenantUid);
                var key           = ApiKeyCache.GetByTenantUid(tenantUid);
                var authorization = await new Authorization().GetAuthorizationAsync(key);

                var response = await _ticketFileService.UploadAnonymous(tenantUid, authorization.AccessToken, origin, file);

                return(Json(response));
            }

            return(Json(new EmptyResult()));
        }
        public async Task <JsonResult> EditPassword(string tenantUid, string username, string customerToken, string oldpassword, string newpassword)
        {
            var newPassword = new EditPassword
            {
                Username    = LoginSession.Username,
                OldPassword = oldpassword,
                NewPassword = newpassword
            };

            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.EditPasswordAsync(newPassword, tenantUid, origin, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 26
0
        public async Task <JsonResult> ChangeEmail(string tenantUid, string id, string username, string email, string language)
        {
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = (ChangeEmailResponseContent)await verificationService.ChangeEmailAsync(tenantUid, origin, username, email, authorization.AccessToken);

            if (response.Success)
            {
                var verificationUrl      = helper.GetConfirmVerificationUrl(tenantUid, origin, email, language, id);
                var postRegisterResponse = await verificationService.VerificationEmailAsync(tenantUid.ToString(), origin, verificationUrl, email, language, authorization.AccessToken);

                postRegisterResponse.RelatedResponse = response;
                return(Json(postRegisterResponse, JsonRequestBehavior.DenyGet));
            }
            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <JsonResult> EditEmail(string tenantUid, string username, string customerToken, string email, string language)
        {
            var origin          = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var verificationUrl = new Uri(new Uri(origin), helper.GetConfirmVerificationUrl(tenantUid, origin, email, language));

            var newEmail = new EditEmail
            {
                Username        = LoginSession.Username,
                Email           = email,
                VerificationUrl = verificationUrl.ToString()
            };
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.EditEmailAsync(newEmail, tenantUid, origin, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
        public async Task <ActionResult> TotalCodeTenantConfirmEmail(ContentModel model)
        {
            var confirmModel = GetModel <ConfirmEmailModel>(CurrentPage);

            confirmModel.BackUrl = LoginSession.LoggedIn ? model.Content.Parent.Children.FirstOrDefault(x => x.ContentType.Alias.Equals("totalCodeAccountPage")).Url : confirmModel.Root.Url;

            if (Request.QueryString.Count == 0)
            {
                return(Redirect("/"));
            }
            //string domain = System.Net.WebUtility.UrlDecode(Request.Url.ToString());
            string id = Request.QueryString["a"], code = Request.QueryString["b"].Replace(" ", "+"), email = Request.QueryString["c"];
            var    tenantUid        = model.Content.Parent.GetProperty("tenantUid").GetValue().ToString();
            var    origin           = TenantHelper.GetCurrentTenantUrl(model);
            string domain           = helper.GetConfirmVerificationUrl(tenantUid, origin, email, Umbraco.CultureDictionary.Culture.TwoLetterISOLanguageName, id, code);
            var    confirmationData = new ConfirmationData
            {
                ClientId        = id,
                Code            = code,
                Email           = email,
                VerificationUrl = new Uri(domain).ToString()
            };

            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = (ConfirmEmailResponseContent)await verificationService.ConfirmEmailAsync(tenantUid, origin, confirmationData.Email, confirmationData.Code, confirmationData.VerificationUrl, authorization.AccessToken);


            confirmationData.IsConfirmed = response.Success;

            if (!response.Success)
            {
                // TODO: remove logging
                logger.Info <ConfirmEmailController>($"Verification Url: {confirmationData.VerificationUrl}");
                logger.Info <ConfirmEmailController>(JsonConvert.SerializeObject(response));
            }

            ViewData["ConfirmationData"] = confirmationData;

            return(Index(confirmModel));
        }
        public ControllerService()
        {
            this.scopeProvider = ConnectorContext.ScopeProvider;
            using (var scope = scopeProvider.CreateScope(autoComplete: true))
            {
                this.database = scope.Database;
                ApiKeyCache.UpdateCache(scope.Database);
            }
            this.userGroupService = new UserGroupService(ConnectorContext.UserService, database, ConnectorContext.Logger);
            this.languageService  = new LanguageDictionaryService(ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.Logger);
            this.homeNode         = new HomeContentNode(ConnectorContext.ContentService, ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.ContentTypeService, ConnectorContext.Logger);
            this.apiService       = new ApiKeysService(database);
            this.nodeHelper       = new NodeHelper();

            SaveAndPublish = bool.Parse(TenantGenerationOptions.SaveAndPublish);
            SecureUrls     = bool.Parse(TenantGenerationOptions.SecureUrls);
            SetupLocalUrls = bool.Parse(TenantGenerationOptions.SetupLocalUrls);

#if DEBUG
            SetupLocalUrls = true;
#endif
        }
        public async Task <JsonResult> EditCommunicationPreferences(string tenantUid, string username, string customerToken, string notify = "false", string notifyViaSms = "false", string notifyViaEmail = "false", string notifyViaPlatform = "false")
        {
            var notifications = new EditCommunicationPreferences
            {
                Username = username,
                CommunicationPreferences = new CommunicationPreferenceParameter[]
                {
                    new CommunicationPreferenceParameter
                    {
                        Communication = "Notification",
                        IsSelected    = bool.Parse(notify)
                    },
                    new CommunicationPreferenceParameter
                    {
                        Communication = "TextMessage",
                        IsSelected    = bool.Parse(notifyViaSms)
                    },
                    new CommunicationPreferenceParameter
                    {
                        Communication = "Email",
                        IsSelected    = bool.Parse(notifyViaEmail)
                    },
                    new CommunicationPreferenceParameter
                    {
                        Communication = "InPlatformMessage",
                        IsSelected    = bool.Parse(notifyViaPlatform)
                    }
                }
            };
            var origin        = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid);
            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);

            var response = await apiService.EditCommunicationPreferencesAsync(notifications, tenantUid, origin, customerToken);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }