From: Date: April 25 2008 9:29pm Subject: Connector/NET commit: r1260 - in branches/5.1: . MySql.Web/Providers/Source MySql.Web/Tests List-Archive: http://lists.mysql.com/commits/46046 X-Bug: 36159 Message-Id: <200804251929.m3PJT0fx014734@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.1/CHANGES branches/5.1/MySql.Web/Providers/Source/MembershipProvider.cs branches/5.1/MySql.Web/Tests/UserManagement.cs Log: - Fixed problem with MembershipUser.GetPassword where attempting to retrieve a password on a user where password Q&A is not required would throw an exception (bug #36159) Modified: branches/5.1/CHANGES =================================================================== --- branches/5.1/CHANGES 2008-04-24 14:07:31 UTC (rev 1259) +++ branches/5.1/CHANGES 2008-04-25 19:29:00 UTC (rev 1260) @@ -12,6 +12,8 @@ closeReader option set to true when we were supposed to. (Bug #34460) - Fixed problem where the bit data type would continue to return null values once it saw a null value in a previous row (bug #36313) + - Fixed problem with MembershipUser.GetPassword where attempting to retrieve a + password on a user where password Q&A is not required would throw an exception (bug #36159) Version 5.1.5 - - Fixed problem with membership provider where FindUserByEmail would fail trying to add Modified: branches/5.1/MySql.Web/Providers/Source/MembershipProvider.cs =================================================================== --- branches/5.1/MySql.Web/Providers/Source/MembershipProvider.cs 2008-04-24 14:07:31 UTC (rev 1259) +++ branches/5.1/MySql.Web/Providers/Source/MembershipProvider.cs 2008-04-25 19:29:00 UTC (rev 1260) @@ -801,9 +801,9 @@ if (reader.GetBoolean(4)) throw new MembershipPasswordException("The supplied user is locked out."); - string password = reader.GetString(0); - string passwordAnswer = reader.GetString(1); - string passwordKey = reader.GetString(2); + string password = reader.IsDBNull(0) ? null : reader.GetString(0); + string passwordAnswer = reader.IsDBNull(1) ? null : reader.GetString(1); + string passwordKey = reader.IsDBNull(2) ? null : reader.GetString(2); MembershipPasswordFormat format = (MembershipPasswordFormat) reader.GetInt32(3); Modified: branches/5.1/MySql.Web/Tests/UserManagement.cs =================================================================== --- branches/5.1/MySql.Web/Tests/UserManagement.cs 2008-04-24 14:07:31 UTC (rev 1259) +++ branches/5.1/MySql.Web/Tests/UserManagement.cs 2008-04-25 19:29:00 UTC (rev 1260) @@ -168,5 +168,34 @@ Assert.Fail(ex.Message); } } + + /// + /// Bug #36159 Problem with 'GetPassword' is Membership provider + /// + [Test] + public void GetPassword() + { + provider = new MySQLMembershipProvider(); + NameValueCollection config = new NameValueCollection(); + config.Add("connectionStringName", "LocalMySqlServer"); + config.Add("applicationName", "/"); + config.Add("enablePasswordRetrieval", "true"); + config.Add("passwordFormat", "Clear"); + config.Add("requireQuestionAndAnswer", "false"); + try + { + provider.Initialize(null, config); + MembershipCreateStatus status; + MembershipUser user = provider.CreateUser("foo", "pass", "foo@stripped", + null, null, true, null, out status); + string password = provider.GetPassword("foo", null); + Assert.AreEqual("pass", password); + } + catch (Exception ex) + { + Assert.Fail(ex.Message); + } + + } } }