Esempio n. 1
0
        // Needed for Password Charge and Password Reset
        public override MembershipUser GetUser(string userName, bool userIsOnline)
        {
            OPathQuery query = new OPathQuery(typeof(C2.User), "Name='" + userName + "'", "Name");

            C2.User user = C2.Manager.ORManager.GetObject <C2.User>(query);
            if (user == null)
            {
                return(null);
            }
            return(new MembershipUser(this.Name, user.Name, user.SequenceId, user.Email, null, null, true, false,
                                      DateTime.MinValue, DateTime.Today, DateTime.Today, DateTime.MinValue, DateTime.MinValue));
        }
Esempio n. 2
0
        public override bool ValidateUser(string userName, string password)
        {
            OPathQuery query = new OPathQuery(typeof(C2.User), "Name='" + userName + "'", "Name");

            C2.User user = C2.Manager.ORManager.GetObject(query) as C2.User;
            if (user == null)
            {
                return(false);
            }
            Encryption.EncryptClass encrypt = new Encryption.EncryptClass();
            return(SafeValue.SafeString(encrypt.DESEnCode(userName, password), "") == user.Pwd);
            // return (user.Pwd == password);
        }
Esempio n. 3
0
        public override MembershipUser CreateUser(string userName, string password, string userEmail, string passwordQuestion,
                                                  string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            C2.User user = new C2.User();

            user.Name  = userName;
            user.Role  = "GUEST";
            user.Pwd   = password;
            user.Email = userEmail;
            status     = MembershipCreateStatus.Success;
            C2.Manager.ORManager.StartTracking(user, InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(user);


            return(new MembershipUser(this.Name, user.Name, user.SequenceId, user.Email, null, null, true, false,
                                      DateTime.MinValue, DateTime.Today, DateTime.Today, DateTime.MinValue, DateTime.MinValue));

            throw new NotSupportedException("The method or operation is not supported.");
        }
Esempio n. 4
0
        public override string ResetPassword(string userName, string answer)
        {
            string password = "******";

            System.Web.Security.Membership.GeneratePassword(
                this.MinRequiredPasswordLength, this.MinRequiredNonAlphanumericCharacters);

            OPathQuery query = new OPathQuery(typeof(C2.User), "Name='" + userName + "'", "Name");

            C2.User user = C2.Manager.ORManager.GetObject <C2.User>(query);
            if (user == null)
            {
                return(null);
            }

            user.Pwd = password;
            C2.Manager.ORManager.StartTracking(user, InitialState.Updated);
            C2.Manager.ORManager.PersistChanges(user);
            return(password);
        }
Esempio n. 5
0
        public override bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            if (!this.ValidPassword(newPassword))
            {
                return(false);
            }

            {
                OPathQuery query = new OPathQuery(typeof(C2.User), "Name='" + userName + "'", "Name");
                C2.User    user  = C2.Manager.ORManager.GetObject(query) as C2.User;
                if (user == null)
                {
                    return(false);
                }
                if (user.Pwd == oldPassword)
                {
                    user.Pwd = newPassword;
                    C2.Manager.ORManager.StartTracking(user, InitialState.Updated);
                    C2.Manager.ORManager.PersistChanges(user);
                    return(true);
                }
            }
            return(false);
        }