#20689 reverted last change and just check current user

This commit is contained in:
Nicholas Mayne
2014-05-11 16:50:14 +01:00
parent 87c60267e1
commit 74026ec729
2 changed files with 4 additions and 4 deletions

View File

@@ -29,11 +29,11 @@ namespace Orchard.Comments.Controllers {
var comment = Services.ContentManager.New<CommentPart>("Comment");
var editorShape = Services.ContentManager.UpdateEditor(comment, this);
if (!ModelState.IsValidField("Comments.Author")) {
if (!ModelState.IsValidField("Comments.Author") && Services.WorkContext.CurrentUser == null) {
Services.Notifier.Error(T("Name is mandatory and must have less than 255 chars"));
}
if (!ModelState.IsValidField("Comments.Email")) {
if (!ModelState.IsValidField("Comments.Email") && Services.WorkContext.CurrentUser == null) {
Services.Notifier.Error(T("Email is invalid or is longer than 255 chars"));
}

View File

@@ -12,7 +12,7 @@ namespace Orchard.Comments.Models {
public LazyField<ContentItem> CommentedOnContentItemField { get { return _commentedOnContentItem; } }
public LazyField<ContentItemMetadata> CommentedOnContentItemMetadataField { get { return _commentedOnContentItemMetadata; } }
[Required, StringLength(255)]
[StringLength(255)]
public string Author {
get { return Record.Author; }
set { Record.Author = value; }
@@ -31,7 +31,7 @@ namespace Orchard.Comments.Models {
set { Record.UserName = value; }
}
[Required, RegularExpression(@"^(?![\.@])(""([^""\r\\]|\\[""\r\\])*""|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$")]
[RegularExpression(@"^(?![\.@])(""([^""\r\\]|\\[""\r\\])*""|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$")]
public string Email {
get { return Record.Email; }
set { Record.Email = value; }