drop obsolete code

This commit is contained in:
Paul Schneider 2017-03-29 01:55:25 +02:00
commit 6bbe89366e
8 changed files with 49 additions and 107 deletions

View file

@ -20,7 +20,7 @@ using Microsoft.Data.Entity;
namespace Yavsc.Controllers
{
[ServiceFilter(typeof(LanguageActionFilter)), AllowAnonymous]
[AllowAnonymous]
public class AccountController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
@ -231,12 +231,12 @@ namespace Yavsc.Controllers
// Sign in the user with this external login provider if the user already has a login.
info.ProviderDisplayName = info.ExternalPrincipal.Claims.First(c=>c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")?.Value;
var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
{
_logger.LogInformation(5, $"User logged in with {info.LoginProvider} provider, as {info.ProviderDisplayName} ({info.ProviderKey})." );
var ninfo = _dbContext.UserLogins.First(l=>l.ProviderKey == info.ProviderKey && l.LoginProvider == info.LoginProvider);
ninfo.ProviderDisplayName = info.ProviderDisplayName;
@ -361,7 +361,7 @@ namespace Yavsc.Controllers
// Don't reveal that the user does not exist or is not confirmed
if (user == null)
_logger.LogWarning($"ForgotPassword: Email {model.Email} not found");
else
else
_logger.LogWarning($"ForgotPassword: Email {model.Email} not confirmed");
return View("ForgotPasswordConfirmation");
}

View file

@ -13,7 +13,7 @@ using Yavsc.ViewModels.Administration;
namespace Yavsc.Controllers
{
[ServiceFilter(typeof(LanguageActionFilter)), Authorize()]
[Authorize()]
public class AdministrationController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
@ -55,7 +55,7 @@ namespace Yavsc.Controllers
}
return Ok(new { message = "you owned it." });
}
[Authorize(Roles = Constants.AdminGroupName)]
[Produces("application/json")]
public async Task<IActionResult> Index()
@ -72,7 +72,7 @@ namespace Yavsc.Controllers
Name = x.Name,
Users = x.Users.Select(u=>u.UserId).ToArray()
});
return View(new AdminViewModel
{
Roles = roles.ToArray(),
@ -80,7 +80,7 @@ namespace Yavsc.Controllers
YouAreAdmin = youAreAdmin
});
}
public IActionResult Role(string id)
{
IdentityRole role = _roleManager.Roles

View file

@ -16,7 +16,6 @@ using Microsoft.AspNet.Mvc.Rendering;
namespace Yavsc.Controllers
{
[ServiceFilter(typeof(LanguageActionFilter))]
public class BlogspotController : Controller
{
ILogger _logger;
@ -114,7 +113,7 @@ namespace Yavsc.Controllers
}
if (!await _authorizationService.AuthorizeAsync(User, blog, new ViewRequirement()))
{
return new ChallengeResult();
return new ChallengeResult();
}
return View(blog);
}
@ -165,11 +164,11 @@ namespace Yavsc.Controllers
ViewBag.ACL = _context.Circle.Where(
c=>c.OwnerId == blog.AuthorId)
.Select(
c => new SelectListItem
{
Text = c.Name,
Value = c.Id.ToString(),
Selected = blog.AuthorizeCircle(c.Id)
c => new SelectListItem
{
Text = c.Name,
Value = c.Id.ToString(),
Selected = blog.AuthorizeCircle(c.Id)
} 
);
return View(blog);
@ -195,7 +194,7 @@ namespace Yavsc.Controllers
_context.SaveChanges(User.GetUserId());
ViewData["StatusMessage"] = "Post modified";
return RedirectToAction("Index");
}
}
else
{
ViewData["StatusMessage"] = "Accès restreint";

View file

@ -18,8 +18,7 @@ namespace Yavsc.Controllers
using Models.Relationship;
using Models.Workflow;
using Services;
[ServiceFilter(typeof(LanguageActionFilter))]
public class CommandController : Controller
{
protected UserManager<ApplicationUser> _userManager;
@ -128,7 +127,7 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(RdvQuery command)
{
var uid = User.GetUserId();
var prid = command.PerformerId;
if (string.IsNullOrWhiteSpace(uid)
@ -151,10 +150,10 @@ namespace Yavsc.Controllers
// ModelState.ClearValidationState("Client.Avatar");
// ModelState.ClearValidationState("ClientId");
ModelState.MarkFieldSkipped("ClientId");
if (ModelState.IsValid)
{
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
if (existingLocation!=null) {

View file

@ -14,8 +14,8 @@ using System.Threading.Tasks;
namespace Yavsc.Controllers
{
using Models;
[ServiceFilter(typeof(LanguageActionFilter)),AllowAnonymous]
[AllowAnonymous]
public class HomeController : Controller
{
public IHostingEnvironment Hosting { get; set; }

View file

@ -26,7 +26,7 @@ namespace Yavsc.Controllers
using PayPal.PayPalAPIInterfaceService;
using PayPal.PayPalAPIInterfaceService.Model;
[Authorize, ServiceFilter(typeof(LanguageActionFilter))]
[Authorize]
public class ManageController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
@ -372,14 +372,14 @@ namespace Yavsc.Controllers
if (result.Succeeded)
{
/* Obsolete : files are no more prefixed using the user name.
var userdirinfo = new DirectoryInfo(
Path.Combine(_siteSettings.UserFiles.DirName,
oldUserName));
var newdir = Path.Combine(_siteSettings.UserFiles.DirName,
model.NewUserName);
if (userdirinfo.Exists)
userdirinfo.MoveTo(newdir);
userdirinfo.MoveTo(newdir);
*/
await _signInManager.SignInAsync(user, isPersistent: false);
@ -529,7 +529,7 @@ namespace Yavsc.Controllers
{
if (ModelState.IsValid)
{
var exSiren = await _dbContext.ExceptionsSIREN.FirstOrDefaultAsync(
ex => ex.SIREN == model.SIREN
);
@ -609,12 +609,12 @@ namespace Yavsc.Controllers
[HttpGet, Route("/Manage/Credits")]
public IActionResult Credits()
{
return View();
}
public Dictionary<string, string> PaypalConfig { 
get { 
var config =
var config =
new Dictionary<string, string>();
config.Add("mode", "sandbox");
config.Add("account1.apiUsername", _payPalSettings.UserId);
@ -622,7 +622,7 @@ namespace Yavsc.Controllers
config.Add("account1.apiSignature", _payPalSettings.Signature);
return config;
}
}
}
protected IActionResult DoDirectCredit(DoDirectCreditViewModel model)
@ -679,7 +679,7 @@ namespace Yavsc.Controllers
// Important: The notify URL applies only to DoExpressCheckoutPayment. This value is ignored when set in SetExpressCheckout or GetExpressCheckoutDetails.
requestDetails.PaymentDetails.NotifyURL = model.IpnNotificationUrl.Trim();
// (Optional) Buyer's shipping address information.
// (Optional) Buyer's shipping address information.
AddressType billingAddr = new AddressType();
if (model.FirstName != string.Empty && model.LastName != string.Empty
&& model.Street1 != string.Empty && model.Country != string.Empty)
@ -708,7 +708,7 @@ namespace Yavsc.Controllers
// Note: You must set the currencyID attribute to one of the 3-character currency codes for any of the supported PayPal currencies.
CurrencyCodeType currency = (CurrencyCodeType)
Enum.Parse(typeof(CurrencyCodeType), model.CurrencyCode);
BasicAmountType paymentAmount = new BasicAmountType(currency, model.Amount);
BasicAmountType paymentAmount = new BasicAmountType(currency, model.Amount);
requestDetails.PaymentDetails.OrderTotal = paymentAmount;
// Invoke the API
@ -716,17 +716,17 @@ namespace Yavsc.Controllers
wrapper.DoDirectPaymentRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
//// TODO clean Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(PaypalConfig);
// # API call
// Invoke the DoDirectPayment method in service wrapper object
// # API call
// Invoke the DoDirectPayment method in service wrapper object
DoDirectPaymentResponseType response = service.DoDirectPayment(wrapper);
// Check for API return status
return setKeyResponseObjects(service, response);
}
@ -749,7 +749,7 @@ namespace Yavsc.Controllers
}
else
{
HttpContext.Items.Add("Response_error", null);
HttpContext.Items.Add("Response_error", null);
responseParams.Add("Transaction Id", response.TransactionID);
responseParams.Add("Payment status", response.PaymentStatus.ToString());
if(response.PendingReason != null) {
@ -759,7 +759,7 @@ namespace Yavsc.Controllers
HttpContext.Items.Add("Response_keyResponseObject", responseParams);
return View("APIResponse");
}
#region Helpers
private void AddErrors(IdentityResult result)