diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs b/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs index 0b31cf10..5bb67326 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaRegularExpression.cs @@ -7,11 +7,14 @@ namespace Yavsc.Attributes.Validation public class YaRegularExpression : System.ComponentModel.DataAnnotations.RegularExpressionAttribute { public YaRegularExpression(string pattern): base (pattern) { - this.ErrorMessage = pattern; + this.ErrorMessage = "RegularExpression: "+ pattern; + } public override string FormatErrorMessage(string name) { + if (ErrorMessageResourceType==null || string.IsNullOrEmpty(ErrorMessageResourceName)) + return ErrorMessage; var prop = this.ErrorMessageResourceType.GetProperty(ErrorMessageResourceName); return (string) prop.GetValue(null, BindingFlags.Static, null, null, System.Globalization.CultureInfo.CurrentUICulture); diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs index bffe5729..926a406a 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs @@ -51,7 +51,6 @@ namespace Yavsc.Attributes.Validation } public override string FormatErrorMessage(string name) { - var temp = base.FormatErrorMessage(name); return string.Format(temp, MinimumLength, maxLen); } diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs b/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs index 5e9c8ca4..827d26ba 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaValidationAttribute.cs @@ -36,7 +36,9 @@ namespace Yavsc.Attributes.Validation public override string FormatErrorMessage(string name) { if (ErrorMessageResourceType == null) // failed :/ + { return base.FormatErrorMessage(name); + } if (ErrorMessageResourceName == null) // re failed :/ return base.FormatErrorMessage(name); diff --git a/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs b/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs index 3cfad860..a9ab63df 100644 --- a/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/ExternalLoginConfirmationViewModel.cs @@ -1,12 +1,14 @@ using System.ComponentModel.DataAnnotations; - +using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { public class ExternalLoginConfirmationViewModel { [Required] + [YaStringLength(2,Constants.MaxUserNameLength)] + [YaRegularExpression(Constants.UserNameRegExp)] public string Name { get; set; } [Required] diff --git a/src/Yavsc/Controllers/Accounting/AccountController.cs b/src/Yavsc/Controllers/Accounting/AccountController.cs index 6baa120e..e5c57a01 100644 --- a/src/Yavsc/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc/Controllers/Accounting/AccountController.cs @@ -504,7 +504,10 @@ namespace Yavsc.Controllers // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713 // 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: "https"); + var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, + protocol: "https", host: Startup.Authority); + + await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"], _localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">"); return View("ForgotPasswordConfirmation"); diff --git a/src/Yavsc/Makefile b/src/Yavsc/Makefile index b237f6b3..a0e6f9b4 100644 --- a/src/Yavsc/Makefile +++ b/src/Yavsc/Makefile @@ -1,7 +1,6 @@ -DESTDIR=/srv/www/yavscpre -PRODDESTDIR=/srv/www/yavsc +DESTDIR=/var/www/yavscpre +PRODDESTDIR=/var/www/yavsc HOSTING=localhost -HOSTADMIN=root ASPNET_LOG_LEVEL=debug SOURCE_DIR=$(HOME)/workspace/yavsc MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make @@ -22,6 +21,13 @@ MINCSS=wwwroot/css/coiffure.min.css wwwroot/css/dev.min.css wwwroot/c web: project.lock.json ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION) +showConfig: + @echo HOSTING: $(USER)@$(HOSTING) + @echo ENV: $(ASPNET_ENV) + @echo CONFIGURATION: $(CONFIGURATION) + @echo DESTDIR: $(DESTDIR) + @echo PRODDESTDIR: $(PRODDESTDIR) + status: ifeq ($(git_status),0) @echo Nothing to be done. @@ -38,19 +44,19 @@ deploy-pkg: publish deploy: pushInPre pushInProd pushInPre: cleanoutput bin/output/wwwroot/version - ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre stop - ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(DESTDIR)/approot - (cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(DESTDIR) >/dev/null) - ssh $(HOSTADMIN)@$(HOSTING) sudo sync - ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre start + ssh $(USER)@$(HOSTING) sudo service kestrel-pre stop + ssh $(USER)@$(HOSTING) sudo rm -rf $(DESTDIR)/approot + (cd bin/output && rsync -ravu ./ $(USER)@$(HOSTING):$(DESTDIR) >/dev/null) + ssh $(USER)@$(HOSTING) sudo sync + ssh $(USER)@$(HOSTING) sudo service kestrel-pre start pushInProd: cleanoutput bin/output/wwwroot/version ifeq ($(git_status),0) - ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel stop - ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(PRODDESTDIR)/approot - (cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(PRODDESTDIR) >/dev/null) - ssh $(HOSTADMIN)@$(HOSTING) sudo sync - ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel start + ssh $(USER)@$(HOSTING) sudo service kestrel stop + ssh $(USER)@$(HOSTING) sudo rm -rf $(PRODDESTDIR)/approot + (cd bin/output && rsync -ravu ./ $(USER)@$(HOSTING):$(PRODDESTDIR) >/dev/null) + ssh $(USER)@$(HOSTING) sudo sync + ssh $(USER)@$(HOSTING) sudo service kestrel start else $(error EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.) git status diff --git a/src/Yavsc/Views/Account/ExternalLoginConfirmation.fr.cshtml b/src/Yavsc/Views/Account/ExternalLoginConfirmation.fr.cshtml index f1524845..4b01b08f 100755 --- a/src/Yavsc/Views/Account/ExternalLoginConfirmation.fr.cshtml +++ b/src/Yavsc/Views/Account/ExternalLoginConfirmation.fr.cshtml @@ -4,7 +4,7 @@ }

@ViewData["Title"].

-

Assoiciez votre compte @ViewData["LoginProvider"].

+

Associez votre compte @ViewData["LoginProvider"].

Formulaire d'Association