mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#20689 reverted last change and just check current user
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user