Skip to content

Commit 04e6d14

Browse files
committed
Readme
1 parent c8255fb commit 04e6d14

File tree

1 file changed

+45
-47
lines changed

1 file changed

+45
-47
lines changed

README.md

+45-47
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,33 @@ Return Stage
3333

3434
1. Add Django Rest Framework’s Token Authentication to your Django Rest Framework project.
3535

36-
REST_FRAMEWORK = {
37-
'DEFAULT_AUTHENTICATION_CLASSES': (
38-
//…
39-
'rest_framework.authentication.TokenAuthentication',
40-
),
41-
}
42-
43-
INSTALLED_APPS = [
44-
45-
'rest_framework.authtoken',
46-
47-
]
36+
REST_FRAMEWORK = {
37+
'DEFAULT_AUTHENTICATION_CLASSES':
38+
('rest_framework.authentication.TokenAuthentication',
39+
)}
40+
41+
INSTALLED_APPS = [
42+
// …
43+
'rest_framework',
44+
'rest_framework.authtoken',
45+
]
4846

4947
And run `manage.py migrate`.
5048

5149
2. Set which types of contact points are allowed for auth in your Settings.py. The available options are `EMAIL` and `MOBILE`.
5250

5351
PASSWORDLESS_AUTH = {
54-
//…
55-
‘PASSWORDLESS_AUTH_TYPES’: [‘EMAIL’, ‘MOBILE’],
56-
//…
52+
//…
53+
‘PASSWORDLESS_AUTH_TYPES’: [‘EMAIL’, ‘MOBILE’],
54+
//…
5755
}
5856

5957
3. Add `drfpasswordless.urls` to your urls.py
6058

6159
urlpatterns = [
62-
//..
63-
url(r'^', include('drfpasswordless.urls')),
64-
//..
60+
//..
61+
url(r'^', include('drfpasswordless.urls')),
62+
//..
6563
]
6664

6765
4. Add an email or mobile number field to your User model. By default drfpasswordless looks for fields named `email` or `mobile` on the User model. If an alias provided doesn’t belong to any given user, a new user is created.
@@ -133,46 +131,46 @@ This can be turned off with the `PASSWORDLESS_REGISTER_NEW_USERS` setting.
133131
Here’s a full list of the configurable defaults.
134132

135133
DEFAULTS = {
136-
# Allowed auth types, can be EMAIL, MOBILE, or both.
137-
'PASSWORDLESS_AUTH_TYPES': ['EMAIL'],
134+
# Allowed auth types, can be EMAIL, MOBILE, or both.
135+
'PASSWORDLESS_AUTH_TYPES': ['EMAIL'],
138136

139-
# Amount of time that tokens last, in seconds
140-
'PASSWORDLESS_TOKEN_EXPIRE_TIME': 15 * 60,
137+
# Amount of time that tokens last, in seconds
138+
'PASSWORDLESS_TOKEN_EXPIRE_TIME': 15 * 60,
141139

142-
# The user's email field name
143-
'PASSWORDLESS_USER_EMAIL_FIELD_NAME': 'email',
140+
# The user's email field name
141+
'PASSWORDLESS_USER_EMAIL_FIELD_NAME': 'email',
144142

145-
# The user's mobile field name
146-
'PASSWORDLESS_USER_MOBILE_FIELD_NAME': 'mobile',
143+
# The user's mobile field name
144+
'PASSWORDLESS_USER_MOBILE_FIELD_NAME': 'mobile',
147145

148-
# Marks itself as verified the first time a user completes auth via token.
149-
# Automatically unmarks itself if email is changed.
150-
'PASSWORDLESS_USER_MARK_VERIFIED_EMAIL': False,
151-
'PASSWORDLESS_USER_EMAIL_VERIFIED_FIELD_NAME': 'email_verified',
146+
# Marks itself as verified the first time a user completes auth via token.
147+
# Automatically unmarks itself if email is changed.
148+
'PASSWORDLESS_USER_MARK_VERIFIED_EMAIL': False,
149+
'PASSWORDLESS_USER_EMAIL_VERIFIED_FIELD_NAME': 'email_verified',
152150

153-
# Marks itself as verified the first time a user completes auth via token.
154-
# Automatically unmarks itself if mobile number is changed.
155-
'PASSWORDLESS_USER_MARK_VERIFIED_MOBILE': False,
156-
'PASSWORDLESS_USER_MOBILE_VERIFIED_FIELD_NAME': 'mobile_verified',
151+
# Marks itself as verified the first time a user completes auth via token.
152+
# Automatically unmarks itself if mobile number is changed.
153+
'PASSWORDLESS_USER_MARK_VERIFIED_MOBILE': False,
154+
'PASSWORDLESS_USER_MOBILE_VERIFIED_FIELD_NAME': 'mobile_verified',
157155

158-
# The email the callback token is sent from
159-
'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS': None,
156+
# The email the callback token is sent from
157+
'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS': None,
160158

161-
# The email subject
162-
'PASSWORDLESS_EMAIL_SUBJECT': "Your Login Token",
159+
# The email subject
160+
'PASSWORDLESS_EMAIL_SUBJECT': "Your Login Token",
163161

164-
# A plaintext email message overridden by the html message. Takes one string.
165-
'PASSWORDLESS_EMAIL_PLAINTEXT_MESSAGE': "Enter this token to sign in: %s",
162+
# A plaintext email message overridden by the html message. Takes one string.
163+
'PASSWORDLESS_EMAIL_PLAINTEXT_MESSAGE': "Enter this token to sign in: %s",
166164

167-
# The email template name.
168-
'PASSWORDLESS_EMAIL_TOKEN_HTML_TEMPLATE_NAME': "passwordless_default_token_email.html",
165+
# The email template name.
166+
'PASSWORDLESS_EMAIL_TOKEN_HTML_TEMPLATE_NAME': "passwordless_default_token_email.html",
169167

170-
# The SMS sent to mobile users logging in. Takes one string.
171-
'PASSWORDLESS_MOBILE_MESSAGE': "Use this code to log in: %s"
168+
# The SMS sent to mobile users logging in. Takes one string.
169+
'PASSWORDLESS_MOBILE_MESSAGE': "Use this code to log in: %s"
172170

173-
# Registers previously unseen aliases as new users.
174-
'PASSWORDLESS_REGISTER_NEW_USERS': True
175-
}
171+
# Registers previously unseen aliases as new users.
172+
'PASSWORDLESS_REGISTER_NEW_USERS': True
173+
}
176174

177175

178176
### Todo

0 commit comments

Comments
 (0)