#363 Support PAM logins with email addresses
Merged 2 years ago by ngompa. Opened 2 years ago by abompard.
abompard/ipsilon login-with-email  into  master

@@ -1,5 +1,6 @@ 

  # Copyright (C) 2013 Ipsilon project Contributors, for license see COPYING

  

+ from pwd import getpwnam

  from ipsilon.login.common import LoginFormBase, LoginManagerBase, \

      LoginManagerInstaller

  from ipsilon.util.plugin import PluginObject
@@ -22,6 +23,10 @@ 

                  username, password, service=self.lm.service_name

              )

              if result:

+                 # The actual username may be different from the requested

+                 # username. For example SSSd allows logging in with the email

+                 # address, but we want the actual username here.

+                 username = getpwnam(username).pw_name

                  self.log("User %s successfully authenticated." % username)

                  return self.lm.auth_successful(

                      self.trans, username, 'password'

Add a call to getpwnam() in the PAM auth module, because the actual
username may be different from the requested username. For example SSSd
allows logging in with the email address, but we want the actual
username to be used throughout the application.

Fixes: #358

Pull-Request has been merged by ngompa

2 years ago
Metadata