Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm trying to retrieve a member in order to generate a new password for them.
Here is my current code
Response.Write("checking for " + tbUsername.Text); //send password if (tbUsername.Text != "") { //query umbraco for username Member memberExists = Member.GetMemberFromLoginName(tbUsername.Text); bool valid = (memberExists == null); if (valid) { Response.Write("valid member"); memberExists.Password = "fish"; memberExists.Save(); //generate password //email password } else { lblError.Text = "Invalid username"; } } else { lblError.Text = "Please enter a username"; }
However my memberExists object is returning null each time, even for valid usernames.
Can anyone help?
ignore me. bug in my code. Solved now.
Hi Shaun,
Can you please share how you have fix this issue.
Thanks
The code
bool valid = (memberExists == null);
should have been
bool valid = (memberExists != null);
Since the original posted question is rather old, you would probably (in case you use Umbraco 7.1 and 6.2 and newer) like to use another way to get the member by username by using the MemberService ( eg. the method GetByUsername(string username) ).
For more info see: MemberService documentation
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Cannot retrieve member using GetMemberFromLoginName
Hi
I'm trying to retrieve a member in order to generate a new password for them.
Here is my current code
Response.Write("checking for " + tbUsername.Text);
//send password
if (tbUsername.Text != "")
{
//query umbraco for username
Member memberExists = Member.GetMemberFromLoginName(tbUsername.Text);
bool valid = (memberExists == null);
if (valid)
{
Response.Write("valid member");
memberExists.Password = "fish";
memberExists.Save();
//generate password
//email password
}
else
{
lblError.Text = "Invalid username";
}
}
else
{
lblError.Text = "Please enter a username";
}
However my memberExists object is returning null each time, even for valid usernames.
Can anyone help?
ignore me. bug in my code. Solved now.
Hi Shaun,
Can you please share how you have fix this issue.
Thanks
The code
should have been
Since the original posted question is rather old, you would probably (in case you use Umbraco 7.1 and 6.2 and newer) like to use another way to get the member by username by using the MemberService ( eg. the method GetByUsername(string username) ).
For more info see: MemberService documentation
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.