UserFactoryFindByLoginOrEmailAndPassword Method |
Find a non-deleted user using his login (or email) and password,
return null if not found.
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IUser FindByLoginOrEmailAndPassword(
IContext context,
string loginOrEmail,
string password
)
Public Shared Function FindByLoginOrEmailAndPassword (
context As IContext,
loginOrEmail As String,
password As String
) As IUser
public:
static IUser^ FindByLoginOrEmailAndPassword(
IContext^ context,
String^ loginOrEmail,
String^ password
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution - loginOrEmail
- Type: SystemString
Login or email of the user to find - password
- Type: SystemString
Password of the user to find
Return Value
Type:
IUserReturn null if the user was not found or deleted, or if the user within the context doesn't have enough right to access it
Examples
Find the user using his login (or email) and password
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
throw contextValidation.Exception;
}
var user = UserFactory.FindByLoginOrEmailAndPassword(context, "login", "secret");
if (user != null)
{
Console.WriteLine("User Id={0} was found: {1}", user.Id, user.Login);
}
else
{
Console.WriteLine("The specified user doesn't exist, or the current user within the context could not access it");
}
See Also