Ejemplo n.º 1
0
        public override string ResetTradePassword(string username)
        {
            string text = Membership.GeneratePassword(10, 0);
            int    num;
            string text2;

            MemberFactory.GetTradePassword(username, out num, out text2);
            string text3 = UserHelper.EncodePassword((MembershipPasswordFormat)num, text, text2);
            string result;

            if (text3.Length > 128)
            {
                result = null;
            }
            else
            {
                Database database = DatabaseFactory.CreateDatabase();
                System.Data.Common.DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE aspnet_Members SET TradePassword = @NewTradePassword, TradePasswordSalt = @PasswordSalt, TradePasswordFormat = @PasswordFormat WHERE UserId = (SELECT UserId FROM aspnet_Users WHERE LOWER(@Username) = LoweredUserName)");
                database.AddInParameter(sqlStringCommand, "NewTradePassword", System.Data.DbType.String, text3);
                database.AddInParameter(sqlStringCommand, "PasswordSalt", System.Data.DbType.String, text2);
                database.AddInParameter(sqlStringCommand, "PasswordFormat", System.Data.DbType.Int32, num);
                database.AddInParameter(sqlStringCommand, "Username", System.Data.DbType.String, username);
                database.ExecuteNonQuery(sqlStringCommand);
                result = text;
            }
            return(result);
        }
Ejemplo n.º 2
0
 private UserFactory GetMemberFactory()
 {
     if (this.UserRole == UserRole.Member)
     {
         return(MemberFactory.Instance());
     }
     throw new System.Exception("UserRole must be Member or Underling");
 }
Ejemplo n.º 3
0
        public static UserFactory Create(UserRole role)
        {
            UserFactory result;

            if (role == UserRole.Member)
            {
                result = MemberFactory.Instance();
            }
            else
            {
                if (role == UserRole.SiteManager)
                {
                    result = ManagerFactory.Instance();
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
 static MemberFactory()
 {
     MemberFactory._defaultInstance          = new MemberFactory();
     MemberFactory._defaultInstance.provider = BizActorProvider.Instance();
 }