east-and-west-magic / django-pgsns

our social networks website
MIT License
0 stars 1 forks source link

定制user authentication #23

Closed yao-eastside closed 5 months ago

yao-eastside commented 5 months ago

不用一般的用户名注册,而是使用email作为唯一标识符。(教程里面有教如何定制)【yulong】

lyl2021 commented 5 months ago

通过在serttings.py文件中添加allauth的配置可指定email作为唯一标识符,且可将用户名输入框去除: ACCOUNT_AUTHENTICATION_METHOD = 'email' # 使用email作为认证标识符; ACCOUNT_ALLOW_EMAIL_LOGIN = True # 允许使用email进行登录 ACCOUNT_EMAIL_REQUIRED = True # 添加email必选项 ACCOUNT_USERNAME_REQUIRED = False # 指定用户名为非必选项 signup 展示界面如下: image login展示界面如下: 1711616030255