-
使用
authenticate()
username
和password
,针对每个身份验证后端检查它们,如果凭据对后端有效,则返回User
PermissionDenied
None
。例如:from django.contrib.auth import authenticate user = authenticate(username='john', password='secret') if user is not None: # A backend authenticated the credentials else: # No backend authenticated the credentials
request
是可选的HttpRequest
authenticate()
方法传递。注意
这是验证一组凭据的低级方法;例如,它被
RemoteUserMiddleware
LoginView
本文介绍 django.contrib.auth.authenticate
的用法。
声明
authenticate(request=None, **credentials)
相关用法
- Python Tableau auth.sign_in用法及代码示例
- Python Tableau auth.sign_out用法及代码示例
- Python Tableau auth.switch_site用法及代码示例
- Python arcgis.gis._impl._profile.ProfileManager.save_as用法及代码示例
- Python arcgis.raster.functions.ccdc_analysis用法及代码示例
- Python arcgis.geometry.functions.trim_extend用法及代码示例
- Python arcgis.raster.analytics.sample用法及代码示例
- Python arcgis.features.analysis.derive_new_locations用法及代码示例
- Python arcgis.features.analyze_patterns.calculate_density用法及代码示例
- Python arcgis.geometry.Geometry.label_point用法及代码示例
- Python ast.MatchClass用法及代码示例
- Python arcgis.plan_routes用法及代码示例
- Python arcgis.mapping.forms.FormInfo用法及代码示例
- Python arcgis.gis.UserManager.get用法及代码示例
- Python arcgis.raster.ImageryLayerCacheManager.update_tiles用法及代码示例
- Python arcgis.geometry.Geometry.true_centroid用法及代码示例
- Python arcgis.gis.User.generate_direct_access_url用法及代码示例
- Python arcgis.gis.GroupMigrationManager.create用法及代码示例
- Python arcgis.geometry.Geometry.hull_rectangle用法及代码示例
- Python arcgis.features.analysis.summarize_within用法及代码示例
- Python arcgis.geometry.filters.intersects用法及代码示例
- Python arcgis.geometry.functions.project用法及代码示例
- Python abc.ABCMeta用法及代码示例
- Python arcgis.raster.functions.percentile用法及代码示例
- Python arcgis.raster.ImageryLayer.save用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.contrib.auth.authenticate。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。