This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% autoescape off %} | |
| <h3> | |
| Hi {{ user.get_username }}, | |
| </h3> | |
| To initiate the password reset process for your account on {{ domain }}, | |
| click the link below: | |
| <br><br> | |
| <a href="{{ protocol }}://{{ domain }}{% url 'reset' uidb64=uid token=token %}">Reset password</a> | |
| <br><br> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django import forms | |
| from django.contrib.auth.forms import UserCreationForm, PasswordResetForm, SetPasswordForm | |
| from django.contrib.auth import get_user_model | |
| User = get_user_model() | |
| class UserPasswordResetForm(SetPasswordForm): | |
| """Change password form.""" | |
| new_password1 = forms.CharField(label='Password', | |
| help_text="<ul class='errorlist text-muted'><li>Your password can 't be too similar to your other personal information.</li><li>Your password must contain at least 8 characters.</li><li>Your password can 't be a commonly used password.</li> <li>Your password can 't be entirely numeric.<li></ul>", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib.auth.tokens import PasswordResetTokenGenerator | |
| from django.utils import six | |
| class AccountActivationTokenGenerator(PasswordResetTokenGenerator): | |
| def _make_hash_value(self, user, timestamp): | |
| return ( | |
| six.text_type(user.pk) + six.text_type(timestamp) + | |
| six.text_type(user.profile.email_confirmed) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.db.models.signals import post_save | |
| from django.dispatch import receiver | |
| from journal.settings import AUTH_USER_MODEL as User | |
| class Profile(models.Model): | |
| user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') | |
| email_confirmed = models.BooleanField(default=False) | |
| reset_password = models.BooleanField(default=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import messages | |
| from django.contrib.auth import login | |
| from django.shortcuts import render, redirect | |
| from django.contrib.sites.shortcuts import get_current_site | |
| from django.template.loader import render_to_string | |
| from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode | |
| from django.utils.encoding import force_bytes, force_text | |
| from django.views.decorators.http import require_http_methods | |
| from project.tokens import account_activation_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import messages | |
| from django.contrib.auth import login | |
| from django.shortcuts import redirect | |
| from django.views.decorators.http import require_http_methods | |
| from project.tokens import account_activation_token | |
| from django.contrib.auth import get_user_model | |
| User = get_user_model() | |
| @require_http_methods(["GET"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import messages | |
| from django.views.decorators.http import require_http_methods | |
| from django.contrib.sites.shortcuts import get_current_site | |
| from django.template.loader import render_to_string | |
| from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode | |
| from project.decorators import check_recaptcha, unauthenticated_required | |
| from project.tokens import password_reset_token | |
| from project.forms import UserForgotPasswordForm | |
| from project.settings import config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import messages | |
| from django.views.decorators.http import require_http_methods | |
| from django.shortcuts import render, redirect | |
| from django.utils.http import urlsafe_base64_decode | |
| from django.utils.encoding import force_text | |
| from project.decorators import check_recaptcha, unauthenticated_required | |
| from project.tokens import password_reset_token | |
| from project.settings import config | |
| from project.forms import UserPasswordResetForm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def modular_function(): | |
| pass | |
| def main(): | |
| # main function that you use to run the program | |
| modular_function() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| def parse_arguments(): | |
| """Read arguments from a command line.""" | |
| parser = argparse.ArgumentParser(description='Arguments get parsed via --commands') | |
| parser.add_argument("-i", metavar='input file', required=True, | |
| help='an input dataset in .txt file') | |
| args = parser.parse_args() |