WebMatrix 1.0 Reset Passwords
The token generated by WebMatrix 1.0 used base64 encoding, and caused odd problems when copy and pasted into web browsers. The following hack addresses the issue.
resetToken = WebSecurity.GeneratePasswordResetToken(email); //Optionally specify an expiration date for the token
// Workaround - WebSecurity v1 generates Base64 encoded strings,
// and are not URL friendly. Use UrlTokenEncodeInstead
try { resetToken = HttpServerUtility.UrlTokenEncode(Convert.FromBase64String(resetToken));}
catch (Exception exc) { // do nothing, GeneratePasswordResetToken may return a previously stored token from database };
db.Execute(
"UPDATE webpages_Membership SET PasswordVerificationToken=@1 WHERE UserId=@0",
userId,
resetToken);
About this entry
You’re currently reading “ WebMatrix 1.0 Reset Passwords ,” an entry on Chui's Counterpoint
- Published:
- 10.10.12 / 11pm
- Category:
- Uncategorized
Comments are closed
Comments are currently closed on this entry.