Fixe l'inscription, affiche un avatar par défaut

This commit is contained in:
2017-03-29 10:38:37 +02:00
parent 0a73c16191
commit cbc9a8ac7d
12 changed files with 2074 additions and 54 deletions

View File

@ -10,7 +10,7 @@ namespace Yavsc
AuthorizePath = "~/authorize", AuthorizePath = "~/authorize",
TokenPath = "~/token", LoginPath = "~/signin", TokenPath = "~/token", LoginPath = "~/signin",
LogoutPath = "~/signout", UserInfoPath = "~/api/me", LogoutPath = "~/signout", UserInfoPath = "~/api/me",
ApplicationAuthenticationSheme = "ServerCookie", ApplicationAuthenticationSheme = "ServerCookie",
ExternalAuthenticationSheme= "ExternalCookie", ExternalAuthenticationSheme= "ExternalCookie",
CompanyInfoUrl = " https://societeinfo.com/app/rest/api/v1/company/json?registration_number={0}&key={1}", CompanyInfoUrl = " https://societeinfo.com/app/rest/api/v1/company/json?registration_number={0}&key={1}",
DefaultFactor = "Default", DefaultFactor = "Default",
@ -26,11 +26,11 @@ namespace Yavsc
GCMNotificationUrl = "https://gcm-http.googleapis.com/gcm/send", GCMNotificationUrl = "https://gcm-http.googleapis.com/gcm/send",
KeyProtectorPurpose = "OAuth.AspNet.AuthServer", KeyProtectorPurpose = "OAuth.AspNet.AuthServer",
UserFilesPath = "/UserFiles", UserFilesPath = "/UserFiles",
AvatarsPath = "/Avatars", AvatarsPath = "/Avatars",
DefaultAvatar = "/images/Users/icon_user.png", DefaultAvatar = "/images/Users/icon_user.png",
AnonAvatar = "/images/Users/icon_anon_user.png"; AnonAvatar = "/images/Users/icon_anon_user.png";
public static readonly long DefaultFSQ = 1024*1024*500; public static readonly long DefaultFSQ = 1024*1024*500;
public static readonly Scope[] SiteScopes = {  public static readonly Scope[] SiteScopes = { 
new Scope { Id = "profile", Description = "Your profile informations" },   new Scope { Id = "profile", Description = "Your profile informations" },  
new Scope { Id = "book" , Description ="Your booking interface"},   new Scope { Id = "book" , Description ="Your booking interface"},  
@ -43,7 +43,7 @@ namespace Yavsc
}; };
public const string SshHeaderKey = "SSH"; public const string SshHeaderKey = "SSH";
private static readonly string[] GoogleScopes = { "openid", "profile", "email" }; private static readonly string[] GoogleScopes = { "openid", "profile", "email" };
public static readonly string[] GoogleCalendarScopes = public static readonly string[] GoogleCalendarScopes =
{ "openid", "profile", "email", "https://www.googleapis.com/auth/calendar" }; { "openid", "profile", "email", "https://www.googleapis.com/auth/calendar" };

View File

@ -43,6 +43,24 @@ namespace Yavsc.Controllers
// If some amdin already exists, make this method disapear // If some amdin already exists, make this method disapear
var admins = await _userManager.GetUsersInRoleAsync(Constants.AdminGroupName); var admins = await _userManager.GetUsersInRoleAsync(Constants.AdminGroupName);
if (admins != null && admins.Count > 0) return HttpNotFound(); if (admins != null && admins.Count > 0) return HttpNotFound();
// ensure all roles existence
foreach (string roleName in new string[] {Constants.AdminGroupName,
Constants.StarGroupName, Constants.PerformerGroupName,
Constants.FrontOfficeGroupName,
Constants.StarHunterGroupName
})
if (!await _roleManager.RoleExistsAsync(roleName))
{
var role = new IdentityRole { Name = roleName };
var resultCreate = await _roleManager.CreateAsync(role);
if (!resultCreate.Succeeded)
{
AddErrors(resultCreate);
return new BadRequestObjectResult(ModelState);
}
}
var user = await _userManager.FindByIdAsync(User.GetUserId()); var user = await _userManager.FindByIdAsync(User.GetUserId());
IdentityRole adminRole; IdentityRole adminRole;
@ -53,6 +71,7 @@ namespace Yavsc.Controllers
AddErrors(addToRoleResult); AddErrors(addToRoleResult);
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
return Ok(new { message = "you owned it." }); return Ok(new { message = "you owned it." });
} }

View File

@ -19,9 +19,9 @@ namespace Yavsc.Helpers
{ {
var user = dbContext.Users.FirstOrDefault(u => u.Id == userId); var user = dbContext.Users.FirstOrDefault(u => u.Id == userId);
if (user==null) return Constants.AnonAvatar; if (user==null) return Constants.AnonAvatar;
if (user.Avatar==null) return Constants.DefaultAvatar;
if (user.Avatar.StartsWith("/")) if (user.Avatar.StartsWith("/"))
{ {
// use fmt
FileInfo fi = new FileInfo(user.Avatar); FileInfo fi = new FileInfo(user.Avatar);
var ext = fi.Extension; var ext = fi.Extension;
var avatar = user.Avatar.Substring(0, user.Avatar.Length - ext.Length ); var avatar = user.Avatar.Substring(0, user.Avatar.Length - ext.Length );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,619 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class avatarMayBeNull : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Connection_ApplicationUser_ApplicationUserId", table: "Connection");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Location_LocationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "AspNetUsers",
nullable: true,
defaultValue: "/images/Users/icon_user.png");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BlackListed_ApplicationUser_OwnerId",
table: "BlackListed",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
table: "CircleAuthorizationToBlogPost",
column: "BlogPostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
table: "CircleAuthorizationToBlogPost",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Connection_ApplicationUser_ApplicationUserId",
table: "Connection",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Activity_ActivityCode",
table: "HairCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_ApplicationUser_ClientId",
table: "HairCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Location_LocationId",
table: "HairCutQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
table: "HairCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_HairPrestation_PrestationId",
table: "HairCutQuery",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
table: "HairMultiCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
table: "HairMultiCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
table: "HairMultiCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_Color_ColorId",
table: "HairTaint",
column: "ColorId",
principalTable: "Color",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_Notification_NotificationId",
table: "DimissClicked",
column: "NotificationId",
principalTable: "Notification",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_ApplicationUser_UserId",
table: "DimissClicked",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Instrumentation_Instrument_InstrumentId",
table: "Instrumentation",
column: "InstrumentId",
principalTable: "Instrument",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandForm_Activity_ActivityCode",
table: "CommandForm",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_Activity_ActivityCode",
table: "RdvQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_ApplicationUser_ClientId",
table: "RdvQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_PerformerProfile_PerformerId",
table: "RdvQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Connection_ApplicationUser_ApplicationUserId", table: "Connection");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Location_LocationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.AlterColumn<string>(
name: "Avatar",
table: "AspNetUsers",
nullable: false,
defaultValue: "/images/Users/icon_user.png");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BlackListed_ApplicationUser_OwnerId",
table: "BlackListed",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
table: "CircleAuthorizationToBlogPost",
column: "BlogPostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
table: "CircleAuthorizationToBlogPost",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Connection_ApplicationUser_ApplicationUserId",
table: "Connection",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Activity_ActivityCode",
table: "HairCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_ApplicationUser_ClientId",
table: "HairCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Location_LocationId",
table: "HairCutQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
table: "HairCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_HairPrestation_PrestationId",
table: "HairCutQuery",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
table: "HairMultiCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
table: "HairMultiCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
table: "HairMultiCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_Color_ColorId",
table: "HairTaint",
column: "ColorId",
principalTable: "Color",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_Notification_NotificationId",
table: "DimissClicked",
column: "NotificationId",
principalTable: "Notification",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_ApplicationUser_UserId",
table: "DimissClicked",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Instrumentation_Instrument_InstrumentId",
table: "Instrumentation",
column: "InstrumentId",
principalTable: "Instrument",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandForm_Activity_ActivityCode",
table: "CommandForm",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_Activity_ActivityCode",
table: "RdvQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_ApplicationUser_ClientId",
table: "RdvQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_PerformerProfile_PerformerId",
table: "RdvQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,6 +1,8 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;
namespace Yavsc.Migrations namespace Yavsc.Migrations
@ -152,7 +154,6 @@ namespace Yavsc.Migrations
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
b.Property<string>("Avatar") b.Property<string>("Avatar")
.IsRequired()
.HasAnnotation("MaxLength", 512) .HasAnnotation("MaxLength", 512)
.HasAnnotation("Relational:DefaultValue", "/images/Users/icon_user.png") .HasAnnotation("Relational:DefaultValue", "/images/Users/icon_user.png")
.HasAnnotation("Relational:DefaultValueType", "System.String"); .HasAnnotation("Relational:DefaultValueType", "System.String");
@ -537,8 +538,7 @@ namespace Yavsc.Migrations
b.Property<DateTime>("EventDate"); b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId") b.Property<long>("LocationId");
.IsRequired();
b.Property<string>("PerformerId") b.Property<string>("PerformerId")
.IsRequired(); .IsRequired();

View File

@ -17,20 +17,20 @@ namespace Yavsc.Models
{ {
/// <summary> /// <summary>
/// Another me, as a byte array. /// Another me, as a byte array.
/// This value points a picture that may be used /// This value points a picture that may be used
/// to sign documents. /// to present the user
/// </summary> /// </summary>
/// <returns>the path to an user's image, relative to it's dir<summary> /// <returns>the path to an user's image, relative to it's user dir<summary>
/// <see>Startup.UserFilesOptions</see> /// <see>Startup.UserFilesOptions</see>
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[MaxLength(512),Required] [MaxLength(512)]
public string Avatar { get; set; } public string Avatar { get; set; }
[MaxLength(512)] [MaxLength(512)]
public string FullName { get; set; } public string FullName { get; set; }
/// <summary> /// <summary>
/// WIP Paypal /// WIP Paypal
/// </summary> /// </summary>
@ -58,7 +58,7 @@ namespace Yavsc.Models
/// <returns></returns> /// <returns></returns>
[InverseProperty("DeviceOwner"),JsonIgnore] [InverseProperty("DeviceOwner"),JsonIgnore]
public virtual List<GoogleCloudMobileDeclaration> Devices { get; set; } public virtual List<GoogleCloudMobileDeclaration> Devices { get; set; }
[InverseProperty("Owner"),JsonIgnore] [InverseProperty("Owner"),JsonIgnore]
public virtual List<Connection> Connections { get; set; } public virtual List<Connection> Connections { get; set; }
@ -88,7 +88,7 @@ namespace Yavsc.Models
} }
public BankIdentity BankInfo { get; set; } public BankIdentity BankInfo { get; set; }
public long DiskQuota { get; set; } = 512*1024*1024; public long DiskQuota { get; set; } = 512*1024*1024;
public long DiskUsage { get; set; } = 0; public long DiskUsage { get; set; } = 0;

View File

@ -302,33 +302,6 @@ namespace Yavsc
else throw ex; else throw ex;
} }
} }
Task.Run(async () =>
{
// Creates roles when they don't exist
foreach (string roleName in new string[] {Constants.AdminGroupName,
Constants.StarGroupName, Constants.PerformerGroupName,
Constants.FrontOfficeGroupName,
Constants.StarHunterGroupName
})
if (!await roleManager.RoleExistsAsync(roleName))
{
var role = new IdentityRole { Name = roleName };
var resultCreate = await roleManager.CreateAsync(role);
if (!resultCreate.Succeeded)
{
throw new Exception("The role '{roleName}' does not exist and could not be created.");
}
}
// FIXME In a perfect world, connection records should be dropped at shutdown, but:
using (var db = new ApplicationDbContext())
{
foreach (var c in db.Connections)
db.Connections.Remove(c);
db.SaveChanges();
}
});
app.UseIISPlatformHandler(options => app.UseIISPlatformHandler(options =>
{ {

View File

@ -6,8 +6,8 @@
@section header{ @section header{
<link href="~/css/quill.snow.css" rel="stylesheet"> <link href="~/css/main/quill.snow.css" rel="stylesheet">
<link href="~/css/dropzone.css" rel="stylesheet"> <link href="~/css/main/dropzone.css" rel="stylesheet">
<style> <style>
.box__dragndrop, .box__dragndrop,

View File

@ -76,9 +76,14 @@ comme il se devrait ...
Pour l'utiliser, vous devrez ajouter une exception pour lui, et continuer votre navigation, Pour l'utiliser, vous devrez ajouter une exception pour lui, et continuer votre navigation,
malgré ce défaut de sécurité (ce sera toujours mieux que sans chiffrement). malgré ce défaut de sécurité (ce sera toujours mieux que sans chiffrement).
--- ---------------
Ainsi va la vie ... Ainsi va la vie ...
</markdown> </markdown>
<a href="@ViewBag.SecureHomeUrl" aria-label="close" class="close" >Lien vers le site sécurisé</a>
<p>
<a data-dismiss="alert" class="btn close ">J'ai compris, et je continue avec cette connexion.</a>
<a href="@ViewBag.SecureHomeUrl" class="btn close" >Lien vers le site sécurisé</a>
</p>
</div> </div>
} }

View File

@ -1,7 +1,7 @@
@model PerformerProfile @model PerformerProfile
@{ ViewData["Title"] = SR["Edit your avatar"]; } @{ ViewData["Title"] = SR["Edit your avatar"]; }
@section header{ @section header{
<link href="~/css/dropzone.css" rel="stylesheet"> <link href="~/css/main/dropzone.css" rel="stylesheet">
} }
@section scripts{ @section scripts{
<script src="~/js/dropzone.js"></script> <script src="~/js/dropzone.js"></script>

View File

@ -17,10 +17,9 @@
<script src="~/js/bootstrap.js" asp-append-version="true"></script> <script src="~/js/bootstrap.js" asp-append-version="true"></script>
<script src="~/js/jquery.signalR-2.2.1.js" asp-append-version="true"></script> <script src="~/js/jquery.signalR-2.2.1.js" asp-append-version="true"></script>
<script src="~/js/site.js" asp-append-version="true"></script> <script src="~/js/site.js" asp-append-version="true"></script>
<style>
</environment> </environment>
<environment names="yavsc,yavscpre,zicmoove,lua"> <environment names="yavsc,yavscpre,zicmoove,lua,coiffure">
<link rel="stylesheet" href="~/css/main/bootstrap.min.css" asp-append-version="true"/> <link rel="stylesheet" href="~/css/main/bootstrap.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/site.min.css" asp-append-version="true"/> <link rel="stylesheet" href="~/css/main/site.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/jquery-ui.min.css" asp-append-version="true"/> <link rel="stylesheet" href="~/css/main/jquery-ui.min.css" asp-append-version="true"/>
@ -41,9 +40,7 @@
</environment> </environment>
<style> <style>
nav { nav { background: url(@Startup.SiteSetup.Banner) 0% 50% no-repeat; padding-left:3em; }
background: url(@Startup.SiteSetup.Banner) 0% 50%;
}
</style> </style>
@RenderSection("header", required: false) @RenderSection("header", required: false)
</head> </head>