strip whitespace in docs

This commit is contained in:
Tobias Bengfort
2021-06-17 09:00:54 +02:00
parent 84f93444a3
commit b18dfe2bb6
6 changed files with 36 additions and 36 deletions

View File

@@ -3,7 +3,7 @@
## Break your login function
Usually your login function will check for username and password, log the user in if the username and password are correct and create the user session, to support mfa, this has to change
* authenticate the user
* if username and password are correct , check if the user has mfa or not
* if user has mfa then redirect to mfa page
@@ -11,13 +11,13 @@ Usually your login function will check for username and password, log the user i
```python
def login(request): # this function handles the login form POST
user = auth.authenticate(username=username, password=password)
user = auth.authenticate(username=username, password=password)
if user is not None: # if the user object exist
from mfa.helpers import has_mfa
res = has_mfa(username = username,request=request) # has_mfa returns false or HttpResponseRedirect
if res:
return res
return log_user_in(request,username=user.username)
return log_user_in(request,username=user.username)
#log_user_in is a function that handles creatung user session, it should be in the setting file as MFA_CALLBACK
```