开发者

Can I override asp:CreateUserWizard to essentially not require a password?

开发者 https://www.devze.com 2022-12-22 23:25 出处:网络
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too large of a barrier to entry and wants to get rid of the password requirement but still have accounts so users si

Got this site with UN/PW set via the Createuserwizard control.

Client considers PW too large of a barrier to entry and wants to get rid of the password requirement but still have accounts so users simply log back in with emaill address only.

I want the quickest fix possible where I use the same provider and control but just use the same static PW for all users on signup, then sort of enter it for them when they "log in" if they return. Works like a cookie basically but has an actual login.

Problem is the Createuserwizard.Pa开发者_JS百科ssword property is read only. Can I do AutoGeneratePassword= true and force it to generate the exact same password every time?

For what it's worth, this is a simple, no secure data, basically not much stored kind of site. Lets not get into whether the req makes sense though, and the implications of this - I probably agree with you :)


Bla, bla, bla lots of stuff you probably agree with... and now to the point:

Just ditch the CreateUserWizard and call MembershipProvider.CreateUser directly. You will have to throw in a few textboxes for the email and stuff instead of the createuserwizard but it should be a walk in the park. For the login, just drop the login control too and add a textbox for the email and a "login" button. Then in code-behind call MembershipProvider.ValidateUser with the email and hardcoded password, and if it returns true (meaning the user exists) you just call FormsAuthentication.SetAuthCookie followed by FormsAuthentication.RedirectFromLoginPage and the user is logged in.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号