83
84 def update_password(self, username, password):
85 if username in aj.users.data['users']:
86 hash = self.hash_password(password.encode('utf-8')) 87 aj.users.data['users'][username]['password'] = hash
88 aj.users.save()
89 return True
136 with open(logo_path, "rb") as image:
137 base64_logo = base64.b64encode(image.read()).decode()
138
139 vars = {140 'BASE64_LOGO': base64_logo,
141 'RESET_LINK': link,
142 }
94
95 return template_path
96
97 def render_template(self, template_path, vars=None): 98 """
99 Use Jinja2 template engine to render the HTML template.
100 Use BeautifulSoup to generate the plain text content with the html content.
Defining a local variable or function with the same name as a built-in object makes the built-in object unusable within the current scope and makes the code prone to bugs.
dict = {} # dict is a Python builtin!
for idx, student in enumerate(students):
dict[student] = idx
roll_number = {}
for idx, student in enumerate(students):
roll_number[student] = idx