views:

128

answers:

3

Hi, I have a (rather dumb) client who has created an account in our website, however, he cannot log in because he hasnt clicked the account activation link yet. for some reason, he doesnt want to click it (he thinks its virus)

anyway, I want to manually set the account to activated via database.. how do I do that? thanks!

( i mean, which fields needs to be changed to what values?)

+1  A: 

Can't you temporary assign your own address to the account and resend the activation url? Maybe he can forward you the mail and you can click the link. Think that is easier than "hacking" your way into the membership provider.

Also calling your client dumb is not a very good way to handle your clients ;)

Gertjan
looks like a good idea, but, our website do not provide a way to resend the activation link!!
iamserious
Let him forward you the mail :) Otherwise try to find out how the activation URL is created. Maybe the url (or parts of it) is stored in the database and you can "recreate" his URL.
Gertjan
we are using the aspnet membership features.. so the activation link will be created from GUID so the chances of recreating it us virtually extremely extremely rare.
iamserious
If the GUID is used your must be able to find the associated GUID somewhere in the system. Try creating you own account and look in the database if you can find anything that is assigned to your account which can be linked to the URL used for the activation. Also by comparing different users (activated and non activated you might find a difference which indicates whether the user is activated or not).
Gertjan
+3  A: 

I did some fiddeling around the aspnet membership table and found out how to activate the account manually!

update aspnetdb.dbo.aspnet_Membership set IsApproved = 1 where UserId = (select UserId From aspnetdb.dbo.aspnet_Users where UserName = @Username)

the userid is ridiculously long so i found it easier to pick it up from username from users table.

iamserious
+3  A: 

call these two methods on your MembershipProvider.

        Membership.GetUser().UnlockUser();
        Membership.GetUser().IsApproved = true;
this. __curious_geek
I wanted to do it on the database level, these methods can be called after the link is clicked and the user lands in the page.. but this user of mine was refusing to click the link so I had to manipulate the columns in database, but thanks :)
iamserious
you can also call it by passing a username as well. No need to touch the database directly. `Membership.GetUser("username").UnlockUser();`
this. __curious_geek
hmm but for this i still need to write the code in some temporary page and compile the whole project and shift the dll's and necessary pages to the dedicated server and run it, then revert it back right? a lot of work for just one time thing!! but may be if i have more clients like this i will integrate it in the future as an "admin only" thing.. thanks for the idea!
iamserious