MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / login

Method login

web/pgadmin/authenticate/ldap.py:163–185  ·  view source on GitHub ↗
(self, form)

Source from the content-addressed store, hash-verified

161 return True, None
162
163 def login(self, form):
164 user = getattr(form, 'user', None)
165 if user is None:
166 if config.LDAP_DN_CASE_SENSITIVE:
167 user = User.query.filter_by(username=self.username).first()
168 else:
169 user = User.query.filter(
170 func.lower(User.username) == func.lower(
171 self.username)).first()
172
173 if user is None:
174 current_app.logger.exception(
175 self.messages('USER_DOES_NOT_EXIST'))
176 return False, self.messages('USER_DOES_NOT_EXIST')
177
178 # Login user through flask_security
179 status = login_user(user)
180 if not status:
181 current_app.logger.exception(self.messages('LOGIN_FAILED'))
182 return False, self.messages('LOGIN_FAILED')
183 current_app.logger.info(
184 "LDAP user {0} logged in.".format(user))
185 return True, None
186
187 def __auto_create_user(self, user_email):
188 """Add the ldap user to the internal SQLite database."""

Callers 13

before_requestFunction · 0.45
test_unauthorizedMethod · 0.45
test_authorizedMethod · 0.45
runTestMethod · 0.45
runTestMethod · 0.45
runTestMethod · 0.45
runTestMethod · 0.45

Calls 4

filterMethod · 0.80
infoMethod · 0.80
firstMethod · 0.65
messagesMethod · 0.45

Tested by 12

test_unauthorizedMethod · 0.36
test_authorizedMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36
runTestMethod · 0.36