ubccr / mokey

FreeIPA self-service account management portal
BSD 3-Clause "New" or "Revised" License
192 stars 47 forks source link

Use email for login #33

Closed AltiUP closed 1 year ago

AltiUP commented 5 years ago

Hello,

First of all, thank you for this nice project.

Is it possible to use email addresses for users to log in, instead of user names?

Thank you CG

aebruno commented 5 years ago

No, this is a limitation of POSIX/FreeIPA. Usernames may only include letters, numbers, _, -, . (I believe) so you can't use an email address as a username.

shahriar52 commented 5 years ago

It can be done in a different way. You can take email address input (also check the email validity) and write a piece of code to convert the '@' symbol to '-' and pass that to freeipa as a username. You have to plug that code into several functions in server/account.go, server/auth.go, server/hydra.go and server/signup.go

For example,

    uid := strings.Replace(email, "@", "-", -1)
    uid = strings.Replace(uid, "+", "_", -1)
AltiUP commented 4 years ago

It can be done in a different way. You can take email address input (also check the email validity) and write a piece of code to convert the '@' symbol to '-' and pass that to freeipa as a username. You have to plug that code into several functions in server/account.go, server/auth.go, server/hydra.go and server/signup.go

For example,

  uid := strings.Replace(email, "@", "-", -1)
  uid = strings.Replace(uid, "+", "_", -1)

And just replace the uid by email, would that be possible?

For example: uid :=c.FormValue("uid")`

uid :=c.FormValue("mail")`

zem commented 3 years ago

Usually logging in via E-Mail is done with a query to figure out which dn contains the E-Mail address the user wants to log in to. That works well until you get to the point where you have multiple accounts containing the same E-Mail address.