Login & ortho
This commit is contained in:
@ -17,6 +17,7 @@ using Yavsc.ViewModels.Account;
|
||||
using Yavsc.Helpers;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Data.Entity;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -107,6 +108,19 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
/*
|
||||
var user = await _userManager.FindByNameAsync(model.UserName);
|
||||
if (user != null)
|
||||
{
|
||||
if (!await _userManager.IsEmailConfirmedAsync(user))
|
||||
{
|
||||
ModelState.AddModelError(string.Empty,
|
||||
"You must have a confirmed email to log in.");
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// This doesn't count login failures towards account lockout
|
||||
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
|
||||
var result = await _signInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, lockoutOnFailure: false);
|
||||
@ -207,6 +221,9 @@ namespace Yavsc.Controllers
|
||||
"Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");
|
||||
// await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
_logger.LogInformation(3, "User created a new account with password.");
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, Startup.SiteSetup.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription avec mot de passe: {user.UserName} ", $"{user.Id}/{user.UserName}/{user.Email}");
|
||||
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
}
|
||||
AddErrors(result);
|
||||
@ -258,7 +275,6 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
_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;
|
||||
_dbContext.Entry(ninfo).State = EntityState.Modified;
|
||||
@ -276,6 +292,7 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewData["jsonres"] = JsonConvert.SerializeObject(result);
|
||||
// If the user does not have an account, then ask the user to create an account.
|
||||
ViewData["ReturnUrl"] = returnUrl;
|
||||
ViewData["LoginProvider"] = info.LoginProvider;
|
||||
@ -332,6 +349,11 @@ namespace Yavsc.Controllers
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
|
||||
|
||||
await _emailSender.SendEmailAsync(_siteSettings, _smtpSettings, Startup.SiteSetup.Owner.EMail,
|
||||
$"[{_siteSettings.Title}] Inscription via {info.LoginProvider}: {user.UserName} ", $"{user.Id}/{user.UserName}/{user.Email}");
|
||||
|
||||
_logger.LogInformation(6, "User created an account using {Name} provider.", info.LoginProvider);
|
||||
|
||||
return Redirect(returnUrl);
|
||||
@ -380,14 +402,22 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = await _userManager.FindByEmailAsync(model.Email);
|
||||
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
|
||||
{
|
||||
// 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
|
||||
_logger.LogWarning($"ForgotPassword: Email {model.Email} not confirmed");
|
||||
var user = await _userManager.FindByEmailAsync(model.LoginOrEmail);
|
||||
|
||||
// Don't reveal that the user does not exist or is not confirmed
|
||||
if (user == null) {
|
||||
user = await _userManager.FindByNameAsync(model.LoginOrEmail);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogWarning($"ForgotPassword: Email or User name {model.LoginOrEmail} not found");
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
}
|
||||
// user != null
|
||||
// We want him to have a confirmed e-mail, and prevent this script
|
||||
// to be used to send e-mail to any arbitrary person
|
||||
if (!await _userManager.IsEmailConfirmedAsync(user)) {
|
||||
_logger.LogWarning($"ForgotPassword: Email {model.LoginOrEmail} not confirmed");
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
|
||||
@ -395,7 +425,7 @@ namespace Yavsc.Controllers
|
||||
// Send an email with this link
|
||||
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
|
||||
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
|
||||
await _emailSender.SendEmailAsync(_siteSettings,_smtpSettings,model.Email, _localizer["Reset Password"],
|
||||
await _emailSender.SendEmailAsync(_siteSettings,_smtpSettings,model.LoginOrEmail, _localizer["Reset Password"],
|
||||
_localizer["Please reset your password by following this link:"] +" <"+ callbackUrl +">" );
|
||||
return View("ForgotPasswordConfirmation");
|
||||
}
|
||||
@ -604,9 +634,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
return await _userManager.FindByIdAsync(HttpContext.User.GetUserId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@
|
||||
<data name="AcceptNotifications"><value>Accepter la notification d'une demande de rendez-vous</value></data>
|
||||
<data name="AcceptPublicContact"><value>Accepter les prises de contact de la part de particuliers</value></data>
|
||||
<data name="AccountBalance"><value>Balance du compte</value></data>
|
||||
<data name="ActivateMyProSettings"><value>Activer mon profile professionnel</value></data>
|
||||
<data name="ActivateMyProSettings"><value>Activer mon profil professionnel</value></data>
|
||||
<data name="Activity"><value>Activité</value></data>
|
||||
<data name="Activities"><value>Activités</value></data>
|
||||
<data name="additionally"><value>de plus</value></data>
|
||||
@ -195,7 +195,7 @@
|
||||
<data name="DoNotPublishMyActivity"><value>Ne pas publier mon activité</value></data>
|
||||
<data name="DoSpecifyCircles"><value>S'il vous plait, spécifiez ceux de vos cercles à qui est destiné ce contenu</value></data>
|
||||
<data name="DocTemplateException"><value>Une erreur est survenue à la génération de votre document</value></data>
|
||||
<data name="DisplayName"><value>Nom affiché</value></data>
|
||||
<data name="DisplayName"><value>Nom affiché</value></data>
|
||||
<data name="Disable"><value>Désactiver</value></data>
|
||||
<data name="Disabled"><value>Désactivé</value></data>
|
||||
<data name="DoPost"><value>Poster</value></data>
|
||||
@ -209,6 +209,7 @@
|
||||
<data name="EndHour"><value>Heure de fin</value></data>
|
||||
<data name="email"><value>e-mail</value></data>
|
||||
<data name="Enter your email."><value>Saisissez votre email.</value></data>
|
||||
<data name="Enter your user name or e-mail."><value>Saisissez votre nom d'utilisateur ou email.</value></data>
|
||||
<data name="entries"><value>entrées</value></data>
|
||||
<data name="Estimate"><value>Estimer</value></data>
|
||||
<data name="Estimate_not_found"><value>Devis non trouvé</value></data>
|
||||
@ -221,7 +222,7 @@
|
||||
|
||||
<data name="BillToSignAsPro"><value>Factures à produire</value></data>
|
||||
<data name="BillToSignAsCli"><value>Factures à honnorer</value></data>
|
||||
<data name="PayementsDone"><value>Paiements effectués</value></data>
|
||||
|
||||
<data name="EstimateWanted"><value>Demande de devis</value></data>
|
||||
<data name="Event date"><value>Date de l'évennement</value></data>
|
||||
<data name="EventWebPage"><value>Page web de l'événement</value></data>
|
||||
@ -264,6 +265,8 @@
|
||||
<data name="Kid"><value>Enfant</value></data>
|
||||
<data name="Location"><value>Lieu</value></data>
|
||||
<data name="Login"><value>Connection</value></data>
|
||||
<data name="LoginOrEmail"><value>Nom d'utilisateur ou e-mail</value></data>
|
||||
|
||||
<data name="Log in"><value>Se connecter</value></data>
|
||||
<data name="Logout"><value>Déconnection</value></data>
|
||||
<data name="Long"><value>long</value></data>
|
||||
@ -310,6 +313,7 @@
|
||||
<data name="OnlyAuthorizedMayContact"><value>Seuls les utilisateurs authorisés peuvent contacter un préstataire par courrier.</value></data>
|
||||
<data name="Password"><value>Mot de passe</value></data>
|
||||
<data name="PaymentConfirmation"><value>Confirmation de paiement</value></data>
|
||||
<data name="PayementsDone"><value>Paiements effectués</value></data>
|
||||
<data name="Pdf version"><value>Version Pdf</value></data>
|
||||
<data name="PerformanceDate"><value>Date de la prestation</value></data>
|
||||
<data name="PerformancePlace"><value>Lieu de la pestation</value></data>
|
||||
@ -330,7 +334,7 @@
|
||||
<data name="PreferedDate"><value>Date souhaitée</value></data>
|
||||
<data name="PresationLocation"><value>Lieu de la présation: {0}.\n</value></data>
|
||||
<data name="Preview"><value>Prévisualiser</value><comment>Prévisualiser le document</comment></data>
|
||||
<data name="Profile edition"><value>Édition du profile</value></data>
|
||||
<data name="Profile edition"><value>Édition du profil</value></data>
|
||||
<data name="Product reference"><value>Référence produit</value></data>
|
||||
<data name="prestation"><value>prestation</value></data>
|
||||
<data name="Professional settings"><value>Paramètres professionels</value></data>
|
||||
@ -348,7 +352,7 @@
|
||||
Veuillez pardonner la gêne occasionnée</value></data>
|
||||
<data name="Remember me"><value>Se souvenir du mot de passe</value></data>
|
||||
<data name="Remove"><value>Supprimer</value></data>
|
||||
<data name="Remove my professional profile"><value>Supprimer mon profile professionnel</value></data>
|
||||
<data name="Remove my professional profile"><value>Supprimer mon profil professionnel</value></data>
|
||||
<data name="Role"><value>Rôle</value></data>
|
||||
<data name="Reset Password"><value>Ré-initialiser votre mot de passe</value></data>
|
||||
<data name="Reset password confirmation"><value>Confirmation de ré-initialiser du mot de passe</value></data>
|
||||
@ -364,7 +368,7 @@
|
||||
<data name="SettingsClass"><value>Classe du paramétrage</value></data>
|
||||
<data name="Short"><value>court</value></data>
|
||||
<data name="Son blog"><value>Son blog</value></data>
|
||||
<data name="Your performer profile"><value>Votre profile professionel</value></data>
|
||||
<data name="Your performer profile"><value>Votre profil professionel</value></data>
|
||||
<data name="Setup below your activity parameters"><value>Positionnez ci-après vos les paramêtre de votre activité</value></data>
|
||||
<data name="SiteSkills"><value>Talents/Compétences/Spécialités gérés sur ce site</value></data>
|
||||
<data name="Skill"><value>Compétence</value></data>
|
||||
@ -427,8 +431,8 @@
|
||||
<data name="yourquerytransmitted"><value>Votre demande a été transmise</value></data>
|
||||
<data name="YourSkills"><value>Vos talents, vos spécialités, le domaine de vos activités</value></data>
|
||||
<data name="Your posts"><value>Vos publications</value></data>
|
||||
<data name="Your profile"><value>Votre profile</value></data>
|
||||
<data name="Your profile"><value>Votre profil</value></data>
|
||||
<data name="YourMessageHasBeenSent"><value>Votre messge a été envoyé</value></data>
|
||||
<data name="Tell more, below, about your query"><value>Dites en plus, ci àprès, à propos de cet évennement</value></data>
|
||||
<data name="UnsetActivity"><value>Supprimer mon profile professionel</value></data>
|
||||
<data name="UnsetActivity"><value>Supprimer mon profil professionel</value></data>
|
||||
</root>
|
||||
|
@ -82,12 +82,13 @@ namespace Yavsc
|
||||
*/
|
||||
}
|
||||
).AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
.AddTokenProvider<EmailTokenProvider<ApplicationUser>>(Constants.DefaultFactor);
|
||||
.AddTokenProvider<EmailTokenProvider<ApplicationUser>>(Constants.DefaultFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.DefaultFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.SMSFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.EMailFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.AppFactor)
|
||||
//
|
||||
// .AddDefaultTokenProviders()
|
||||
;
|
||||
}
|
||||
private void ConfigureOAuthApp(IApplicationBuilder app,
|
||||
SiteSettings settingsOptions, ILogger logger)
|
||||
|
@ -6,7 +6,7 @@ namespace Yavsc.ViewModels.Account
|
||||
public class ForgotPasswordViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
[StringLength(512)]
|
||||
public string LoginOrEmail { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace Yavsc.ViewModels.Account
|
||||
/// When true, asks for a two-factor identification
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Display(Name = "Remember me?")]
|
||||
[Display(Name = "Se souvenir de moi?")]
|
||||
public bool RememberMe { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -4,7 +4,7 @@ namespace Yavsc.ViewModels.Account
|
||||
{
|
||||
public class RegisterViewModel
|
||||
{
|
||||
[Required]
|
||||
[Required][Display(Name = "Nom d'utilisateur")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[Required]
|
||||
@ -13,14 +13,14 @@ namespace Yavsc.ViewModels.Account
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
[StringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
|
||||
[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.")]
|
||||
[Display(Name = "Mot de passe")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
[Display(Name = "Confirmer le mot de passe")]
|
||||
[Compare("Password", ErrorMessage = "Le mot de passe et sa confirmation ne sont pas les mêmes.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
public string GoogleRegId { get; set; }
|
||||
|
@ -9,13 +9,13 @@ namespace Yavsc.ViewModels.Account
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[StringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
[Display(Name = "Confirmer le mot de passe")]
|
||||
[Compare("Password", ErrorMessage = "Le mot de passe et sa confirmation ne sont pas les mêmes.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
@ -12,10 +12,10 @@ namespace Yavsc.ViewModels.Account
|
||||
|
||||
public string ReturnUrl { get; set; }
|
||||
|
||||
[Display(Name = "Remember this browser?")]
|
||||
[Display(Name = "Se souvenir de ce navigateur?")]
|
||||
public bool RememberBrowser { get; set; }
|
||||
|
||||
[Display(Name = "Remember me?")]
|
||||
[Display(Name = "Se souvenir de moi?")]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
<h2>@ViewData["Title"].</h2>
|
||||
<h3>Associate your @ViewData["LoginProvider"] account.</h3>
|
||||
|
||||
@ViewData["jsonres"]
|
||||
|
||||
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
|
||||
<h4>Association Form</h4>
|
||||
<hr />
|
||||
|
@ -6,14 +6,14 @@
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
|
||||
<form asp-controller="Account" asp-action="ForgotPassword" method="post" class="form-horizontal" role="form">
|
||||
<h4>@SR["Enter your email."]</h4>
|
||||
<h4>@SR["Enter your user name or e-mail."]</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<label class="col-md-2 control-label">@SR["LoginOrEmail"]</label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
<input asp-for="LoginOrEmail" class="form-control" />
|
||||
<span asp-validation-for="LoginOrEmail" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -56,7 +56,7 @@
|
||||
@SR["Title"]
|
||||
</th>
|
||||
<th>
|
||||
apperçu
|
||||
aperçu
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
|
@ -29,7 +29,7 @@ la prestation, une collecte du retour du client, et un paiement du prestataire d
|
||||
|
||||
Ni le client ni le prestataire ne sont anonymes pour l'applications,
|
||||
il sont même formellement authentifies par l'acquitement d'une première
|
||||
facturation en ligne, ou à l'occasion de la saisie de leur profile proféssionnel.
|
||||
facturation en ligne, ou à l'occasion de la saisie de leur profil proféssionnel.
|
||||
|
||||
Durant la phase de construction d'un contrat de prestation,
|
||||
le client et l'artiste peuvent profiter d'un canal de communication privé et anonyme,
|
||||
@ -51,11 +51,11 @@ d'effectuer toute prestation en relation tant le paiement associé laisse à dou
|
||||
Une fois sa prestation associée exécutée, les paiements relatifs sont effectués auprès de l'artiste.
|
||||
|
||||
Pour un contrat exécuté et non honoré par le client, le processus de poursuite en recouvrement est engagé, sinon, le contrat est archivé,
|
||||
des attestations de paiement sont disponible pour l'artiste et la facture est marquée payée, puis repostée au client.
|
||||
des attestations de paiement sont disponibles pour l'artiste et la facture est marquée payée, puis repostée au client.
|
||||
|
||||
### Pour l'artiste
|
||||
|
||||
L'artiste choisit plusieurs paramètres qui vont faire son profile :
|
||||
L'artiste choisit plusieurs paramètres qui vont faire son profil :
|
||||
|
||||
* Le type d'activités qu'il veut promouvoir, le type de prestations qu'il fournit (est-ce un DJ,
|
||||
un chanteur solo, un musicien solo, un ensemble musical classique, un groupe)
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
@if (Model.EmailConfirmed) {
|
||||
<text>(@SR["Adresse E-mail confirmée"])</text>
|
||||
}else {
|
||||
} else {
|
||||
<text>
|
||||
<i> (@SR["Adresse non confirmée."])</i>
|
||||
<form asp-action="SendEMailForConfirm" asp-controller="Account" enctype="multipart/form-data">
|
||||
|
Reference in New Issue
Block a user