Authenticate through all the sources.
(self)
| 284 | return False |
| 285 | |
| 286 | def authenticate(self): |
| 287 | """Authenticate through all the sources.""" |
| 288 | status = False |
| 289 | msg = None |
| 290 | for src in self.auth_sources: |
| 291 | source = get_auth_sources(src) |
| 292 | self.set_source(source) |
| 293 | current_app.logger.debug( |
| 294 | "Authentication initiated via source: %s" % |
| 295 | source.get_source_name()) |
| 296 | |
| 297 | status, msg = source.authenticate(self.form) |
| 298 | |
| 299 | if status: |
| 300 | self.set_current_source(source.get_source_name()) |
| 301 | if msg is not None and 'username' in msg: |
| 302 | self.form._fields['email'].data = msg['username'] |
| 303 | return status, msg |
| 304 | else: |
| 305 | current_app.logger.debug( |
| 306 | "Authentication initiated via source: %s is failed." % |
| 307 | source.get_source_name()) |
| 308 | return status, msg |
| 309 | |
| 310 | def login(self): |
| 311 | status, msg = self.source.login(self.form) |
no test coverage detected