Пример #1
0
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return(HttpNotFound());
            }

            var package = _packageService.FindPackageRegistrationById(id);

            if (package == null)
            {
                return(HttpNotFound());
            }

            var user = _userService.FindByUsername(username);

            if (user == null)
            {
                return(HttpNotFound());
            }

            if (!String.Equals(user.Username, User.Identity.Name, StringComparison.OrdinalIgnoreCase))
            {
                return(new HttpStatusCodeResult(403));
            }

            var model = new PackageOwnerConfirmationModel
            {
                Success   = _packageService.ConfirmPackageOwner(package, user, token),
                PackageId = id
            };

            return(View(model));
        }
Пример #2
0
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return(HttpNotFound());
            }

            if (!String.Equals(username, User.Identity.Name, StringComparison.OrdinalIgnoreCase))
            {
                return(View(new PackageOwnerConfirmationModel()
                {
                    Username = username,
                    Result = ConfirmOwnershipResult.NotYourRequest
                }));
            }

            var package = _packageService.FindPackageRegistrationById(id);

            if (package == null)
            {
                return(HttpNotFound());
            }

            var user = GetCurrentUser();
            ConfirmOwnershipResult result = _packageService.ConfirmPackageOwner(package, user, token);

            var model = new PackageOwnerConfirmationModel
            {
                Result    = result,
                PackageId = package.Id
            };

            return(View(model));
        }
Пример #3
0
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token)) return HttpNotFound();

            var package = packageSvc.FindPackageRegistrationById(id, useCache: false);
            if (package == null) return HttpNotFound();

            var user = userSvc.FindByUsername(username);
            if (user == null) return HttpNotFound();

            if (!String.Equals(user.Username, User.Identity.Name, StringComparison.OrdinalIgnoreCase)) return new HttpStatusCodeResult(403);

            var model = new PackageOwnerConfirmationModel
            {
                Success = packageSvc.ConfirmPackageOwner(package, user, token),
                PackageId = id
            };

            return View("~/Views/Packages/ConfirmOwner.cshtml", model);
        }
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return HttpNotFound();
            }

            var package = _packageService.FindPackageRegistrationById(id);
            if (package == null)
            {
                return HttpNotFound();
            }

            var user = _userService.FindByUsername(username);
            if (user == null)
            {
                return HttpNotFound();
            }

            if (!String.Equals(user.Username, User.Identity.Name, StringComparison.OrdinalIgnoreCase))
            {
                return new HttpStatusCodeResult(403);
            }

            var model = new PackageOwnerConfirmationModel
                {
                    Success = _packageService.ConfirmPackageOwner(package, user, token),
                    PackageId = id
                };

            return View(model);
        }
Пример #5
0
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return HttpNotFound();
            }

            if (!String.Equals(username, User.Identity.Name, StringComparison.OrdinalIgnoreCase))
            {
                return View(new PackageOwnerConfirmationModel()
                {
                    Username = username,
                    Result = ConfirmOwnershipResult.NotYourRequest
                });
            }

            var package = _packageService.FindPackageRegistrationById(id);
            if (package == null)
            {
                return HttpNotFound();
            }

            var user = GetCurrentUser();
            ConfirmOwnershipResult result = _packageService.ConfirmPackageOwner(package, user, token);

            var model = new PackageOwnerConfirmationModel
                {
                    Result = result,
                    PackageId = package.Id
                };

            return View(model);
        }
        public virtual ActionResult ConfirmOwner(string id, string username, string token)
        {
            if (String.IsNullOrEmpty(token)) return HttpNotFound();

            var package = packageSvc.FindPackageRegistrationById(id, useCache: false);
            if (package == null) return HttpNotFound();

            var user = userSvc.FindByUsername(username);
            if (user == null) return HttpNotFound();

            if (!String.Equals(user.Username, User.Identity.Name, StringComparison.OrdinalIgnoreCase)) return new HttpStatusCodeResult(403);

            var model = new PackageOwnerConfirmationModel
            {
                Success = packageSvc.ConfirmPackageOwner(package, user, token),
                PackageId = id
            };

            return View("~/Views/Packages/ConfirmOwner.cshtml", model);
        }