Login with email not UserName
When using the membership, user and roles providers, what is a
straight forward way to get users to login using an email address and
not a username?
Re: Login with email not UserName
On Mar 31, 9:36=A0pm, andyt... [at] gmail.com wrote:
> When using the membership, user and roles providers, what is a
> straight forward way to get users to login using an email address and
> not a username?
OK, I just persisted on my search and found a simple enough answer:
Protected Sub AuthenticateLogin(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs) Handles
Login1.Authenticate
'
Dim UserInfo As MembershipUser
Dim UserInfoColl As MembershipUserCollection
Dim sUserName As String
UserInfoColl =3D Membership.FindUsersByEmail(Login1.UserName)
sUserName =3D ""
For Each UserInfo In UserInfoColl
' Should only return one.
sUserName =3D UserInfo.UserName
Next
If Membership.ValidateUser(sUserName, Login1.Password) Then
e.Authenticated =3D True
Else
e.Authenticated =3D False
End If
End Sub
I'm sure there are better ways, and I will have a look at this later
(although any suggestions would be appreciated).
All I need to do now is find the best way to link this to my Staff
database.