I have used the login and register snippets and wish to provide a retrieve password service using a form. but receive the error 'CS1502: The best overloaded method match for 'Umbraco.Core.Services.IMemberService.SavePassword(Umbraco.Core.Models.IMember, string)' has some invalid arguments' for the code below.
var email = Request["tb_email"];
var cMember = ApplicationContext.Services.UserService.GetByEmail(email);
var member = Members.GetByEmail(email);
var memberid = member.Id;
var memberName = Membership.GetUser(member.Id).UserName;
if(member != null)
{
@* GENERATE NEW PASSWORD *@
var newpassword = Membership.GeneratePassword(10, 1).ToString();
newpassword = Regex.Replace(newpassword, @"[^a-zA-Z0-9]", m => "9");
@* Change the password to the new generated one above *@
ApplicationContext.Current.Services.MemberService.SavePassword(memberid, newpassword);
Message ="<h3 style='color:red;'>Your new password has been sent to " + email + "</h3>";
}
else
{
Message ="<h3 style='color:red;'>Sorry no account exists for " + email + "</h3>";
}
}
else
{
Message="This is without postback";
}
Compiler Error Message: CS1502: The best overloaded method match for 'Umbraco.Core.Services.IMemberService.SavePassword(Umbraco.Core.Models.IMember, string)' has some invalid arguments
Source Error:
Line 35: @* Change the password to the new generated one above*@
Line 36:
Line 37: ApplicationContext.Current.Services.MemberService.SavePassword(member, newpassword);
Programmatically saving member password.
I have used the login and register snippets and wish to provide a retrieve password service using a form. but receive the error 'CS1502: The best overloaded method match for 'Umbraco.Core.Services.IMemberService.SavePassword(Umbraco.Core.Models.IMember, string)' has some invalid arguments' for the code below.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using System.Web.Mvc.Html @using ClientDependency.Core.Mvc @using System.Net.Mail @using System.Text.RegularExpressions; @using System.Web.Security; @using Umbraco.Core; @using Umbraco.Core.Models; @using Umbraco.Core.Services; @using Umbraco.Web.WebApi; @using Umbraco.Web; @using Umbraco.Web.Models; @using Umbraco.Web.Controllers;
@{ var Message=""; if(IsPost) {
}
@Umbraco.Field("pageName")
@Html.Raw(Message)
Hi Andrew,
Try this - you need to pass the member, not the id.
ApplicationContext.Current.Services.MemberService.SavePassword(member, newpassword);
Thanks but still get !
Source Error:
Line 35: @* Change the password to the new generated one above*@ Line 36:
Line 37: ApplicationContext.Current.Services.MemberService.SavePassword(member, newpassword);
Hi,
Sorry - I missed the problem first time around.
It's here:
var member = Members.GetByEmail(email);
Change this to :
var member = ApplicationContext.Current.Services.MemberService.GetByEmail(email);
Perfect!
Many thanks for your time.
is working on a reply...