mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-23 21:32:14 +08:00
Fixing SigninUserActivity bug.
The bug caused to always fail authentication if no username/password was present, even if the workflow context was a User.
This commit is contained in:
@@ -50,16 +50,17 @@ namespace Orchard.Users.Activities {
|
||||
var userNameOrEmail = activityContext.GetState<string>("UserNameOrEmail");
|
||||
var password = activityContext.GetState<string>("Password");
|
||||
var createPersistentCookie = IsTrueish(activityContext.GetState<string>("CreatePersistentCookie"));
|
||||
var user = workflowContext.Content != null ? workflowContext.Content.As<IUser>() : default(IUser);
|
||||
|
||||
if (String.IsNullOrWhiteSpace(userNameOrEmail) || String.IsNullOrWhiteSpace(password)) {
|
||||
yield return T("IncorrectUserNameOrPassword");
|
||||
yield break;
|
||||
if (user == null) {
|
||||
if (String.IsNullOrWhiteSpace(userNameOrEmail) || String.IsNullOrWhiteSpace(password)) {
|
||||
yield return T("IncorrectUserNameOrPassword");
|
||||
yield break;
|
||||
}
|
||||
|
||||
user = _membershipService.ValidateUser(userNameOrEmail, password);
|
||||
}
|
||||
|
||||
var user = !String.IsNullOrWhiteSpace(userNameOrEmail)
|
||||
? _membershipService.ValidateUser(userNameOrEmail, password)
|
||||
: workflowContext.Content != null ? workflowContext.Content.As<UserPart>() : default(UserPart);
|
||||
|
||||
if (user == null) {
|
||||
yield return T("IncorrectUserNameOrPassword");
|
||||
yield break;
|
||||
|
||||
Reference in New Issue
Block a user