Click or drag to resize

IUserIsPasswordMatch Method

Check whenever the specified password match the current user password

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
bool IsPasswordMatch(
	string password
)

Parameters

password
Type: SystemString
Password to check

Return Value

Type: Boolean
True if the password match the current user password
Examples

This example show how to use the IsPasswordMatch method

using system;
using AskiaPortalCmn;

namespace MyApp 
{
    class Program
    {
         static void Main(string[] args)
         {
                var context = ContextFactory.CreateByLoginAndPassword("login", "secret");
                var contextValidation = context.Validate();
                if (!contextValidation.Success)
                {
                    Console.Error.WriteLine("Invalid context");
                    Console.Error.Write(contextValidation.Exception.Message);
                    return;
                }

                Console.WriteLine("Match `secret`: " + context.user.IsPasswordMatch("secret"));
                Console.WriteLine("Match `wrong`: " + context.user.IsPasswordMatch("wrong"));
                // ---> Produce
                // ""Match `secret`: True"
                // ""Match `wrong`: False"
         }
    }
}
See Also