This commit is contained in:
Paul Schneider 2019-10-08 23:41:19 +01:00
commit fa8e032d21
18 changed files with 102 additions and 80 deletions

View file

@ -1,69 +1,19 @@
namespace Yavsc
namespace Yavsc.Server
{
using Microsoft.AspNet.Http;
using Yavsc.Models.Auth;
public static class Constants
public static class ServerConstants
{
public const string ApplicationName = "Yavsc",
CompanyClaimType = "https://schemas.pschneider.fr/identity/claims/Company",
UserNameRegExp = @"^[a-zA-Z][a-zA-Z0-9._-]*$",
UserFileNamePatternRegExp = @"^([a-zA-Z0-9._-]*/)*[a-zA-Z0-9._-]+$",
AuthorizePath = "~/authorize",
TokenPath = "~/token",
LoginPath = "~/signin",
LogoutPath = "~/signout", UserInfoPath = "~/api/me",
SignalRPath = "/api/signalr",
LiveUserPath = "live",
public const string ApplicationName = "Yavsc";
public const string CompanyInfoUrl = " https://societeinfo.com/app/rest/api/v1/company/json?registration_number={0}&key={1}";
ApplicationAuthenticationSheme = "ServerCookie",
ExternalAuthenticationSheme= "ExternalCookie",
CompanyInfoUrl = " https://societeinfo.com/app/rest/api/v1/company/json?registration_number={0}&key={1}",
DefaultFactor = "Default",
MobileAppFactor = "Mobile Application",
EMailFactor = "Email",
SMSFactor = "SMS",
AdminGroupName = "Administrator",
PerformerGroupName = "Performer",
StarGroupName = "Star",
StarHunterGroupName = "StarHunter",
BlogModeratorGroupName = "Moderator",
FrontOfficeGroupName = "FrontOffice",
GCMNotificationUrl = "https://gcm-http.googleapis.com/gcm/send",
UserFilesPath = "/files",
AvatarsPath = "/avatars",
GitPath = "/sources",
DefaultAvatar = "/images/Users/icon_user.png",
AnonAvatar = "/images/Users/icon_anon_user.png",
YavscConnectionStringEnvName = "YAVSC_DB_CONNECTION";
// at the end, let 4*4 bytes in peace
public const int WebSocketsMaxBufLen = 4*1020;
public static readonly long DefaultFSQ = 1024*1024*500;
public static readonly Scope[] SiteScopes = { 
new Scope { Id = "profile", Description = "Your profile informations" },  
new Scope { Id = "book" , Description ="Your booking interface"},  
new Scope { Id = "blog" , Description ="Your blogging interface"},  
new Scope { Id = "estimate" , Description ="Your estimation interface"},  
new Scope { Id = "contract" , Description ="Your contract signature access"}, 
new Scope { Id = "admin" , Description ="Your administration rights on this site"}, 
new Scope { Id = "moderation" , Description ="Your moderator interface"}, 
new Scope { Id = "frontoffice" , Description ="Your front office interface" }
};
public const string SshHeaderKey = "SSH";
private static readonly string[] GoogleScopes = { "openid", "profile", "email" };
public static readonly string[] GoogleCalendarScopes =
{ "openid", "profile", "email", "https://www.googleapis.com/auth/calendar" };
public static readonly string NoneCode = "none";
public const int MaxUserNameLength = 26;
public const string LivePath = "/live/cast";
}
}

View file

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Yavsc.Abstract;
using Yavsc.Abstract.Identity.Security;
using Yavsc.Attributes.Validation;
using Yavsc.Models.Relationship;
@ -27,4 +28,4 @@ namespace Yavsc.Server.Models.Access
[ForeignKey("CircleId"), JsonIgnore]
public virtual Circle Circle { get; set; }
}
}
}

View file

@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Auth {
public class Scope {
[Key]
public string Id { get; set; }
public string Description { get; set; }
}
}

View file

@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Abstract;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account

View file

@ -1,33 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
using Yavsc;
public class RegisterViewModel
{
[YaStringLength(2,Constants.MaxUserNameLength)]
[YaRegularExpression(Constants.UserNameRegExp)]
public string UserName { get; set; }
[YaRequired()]
[YaStringLength(2,102)]
// [EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; }
[YaStringLength(6,100)]
[DataType(DataType.Password)]
// ErrorMessage = "Les mots de passe doivent contenir au moins un caractère spécial, qui ne soit ni une lettre ni un chiffre.")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Compare("Password")]
public string ConfirmPassword { get; set; }
}
}