public override bool ValidateUser(string username, string password)
        {
            UserProfile userProfile = UserProfileFactory.GetUserProfile(username);

            if (userProfile != null && userProfile.VerifyPassword(password))
            {
                userProfile.SetAsCurrentVisitor();
                return(true);
            }
            UserProfile.ClearCurrentVisitor();
            return(false);
        }
Example #2
0
        static void Main(string[] args)
        {
            Debug.Assert(args.Length == 1);
            if (args.Length != 1)
            {
                Usage();
                return;
            }

            String srcPath = args[0];

            IUserProfile profile = new UserProfileFactory().CreateUserProfile();

            try
            {
                Console.Write("Loading source profile [{0}]...", Path.GetFileName(srcPath));
                profile.Load(srcPath, null);
                Console.WriteLine("ok");

                String dstPath = srcPath + ".sdf";

                if (File.Exists(dstPath))
                {
                    File.Delete(dstPath);
                }

                Console.Write("Opening destination database [{0}]...", Path.GetFileName(dstPath));
                using (SqlCeConnection conn = DataUtils.OpenDatabase(dstPath, DataUtils.PASSWORD_PROFILE, DataUtils.SCHEMA_PROFILE))
                {
                    Console.WriteLine("ok");

                    Console.WriteLine("Conversion started...");
                    Convert(profile, conn);
                    Console.WriteLine("Conversion finished.");

                    conn.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine();
                Console.WriteLine("*** ERROR: " + e.Message);
            }
        }