my-cloud-devops-consulting 1.1.202507091017__py3-none-any.whl → 1.1.202507100102__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app.py CHANGED
@@ -200,6 +200,56 @@ def sitemap():
200
200
  def robots():
201
201
  return app.send_static_file('robots.txt')
202
202
 
203
+
204
+
205
+
206
+ # adding logic for passwords reset
207
+
208
+ from itsdangerous import URLSafeTimedSerializer
209
+
210
+ serializer = URLSafeTimedSerializer(SECRET_KEY)
211
+
212
+ @app.route('/forgot-password', methods=['GET', 'POST'])
213
+ def forgot_password():
214
+ if request.method == 'POST':
215
+ email = request.form['email']
216
+ user = users_collection.find_one({'username': email})
217
+ if user:
218
+ token = serializer.dumps(str(user['_id']), salt='password-reset')
219
+ reset_url = url_for('reset_password', token=token, _external=True)
220
+ send_email("Password Reset Request", email, f"Click here to reset your password: {reset_url}")
221
+ flash("Password reset link sent to your email.", "info")
222
+ else:
223
+ flash("User not found.", "error")
224
+ return render_template('forgot-password.html')
225
+
226
+
227
+ # adding logic for passwords reset
228
+
229
+ @app.route('/reset-password/<token>', methods=['GET', 'POST'])
230
+ def reset_password(token):
231
+ try:
232
+ user_id = serializer.loads(token, salt='password-reset', max_age=3600) # 1 hour
233
+ except:
234
+ flash("The reset link is invalid or has expired.", "danger")
235
+ return redirect(url_for('login'))
236
+
237
+ if request.method == 'POST':
238
+ new_password = request.form['password']
239
+ hashed = generate_password_hash(new_password)
240
+ users_collection.update_one({'_id': ObjectId(user_id)}, {'$set': {'password': hashed}})
241
+ flash("Password updated. Please log in.", "success")
242
+ return redirect(url_for('login'))
243
+
244
+ return render_template('reset-password.html')
245
+
246
+
247
+
248
+ # Cookies
249
+ @app.route('/cookie-policy')
250
+ def cookie_policy():
251
+ return render_template('cookie-policy.html')
252
+
203
253
  if __name__ == '__main__':
204
254
  app.run(debug=True, host='0.0.0.0', port=50)
205
255
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: my-cloud-devops-consulting
3
- Version: 1.1.202507091017
3
+ Version: 1.1.202507100102
4
4
  Summary: This is my consulting website for Cloud & DevOps services.
5
5
  Home-page: https://github.com/Betrand1999/project-root
6
6
  Author: Betrand Mutagha
@@ -0,0 +1,5 @@
1
+ app.py,sha256=louT27AsKc_y2u88tG8VMnSp4UPbHKg6LmttWc19lqg,8908
2
+ my_cloud_devops_consulting-1.1.202507100102.dist-info/METADATA,sha256=iRJQpXeRqnz-9IRn4hE8HZMJtKHUMPh9tcRhUHQYlA0,3329
3
+ my_cloud_devops_consulting-1.1.202507100102.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
+ my_cloud_devops_consulting-1.1.202507100102.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
5
+ my_cloud_devops_consulting-1.1.202507100102.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- app.py,sha256=yJE0wjGdL3gi3LDLYb11muEE_CifxomairBgXbqsI5E,7250
2
- my_cloud_devops_consulting-1.1.202507091017.dist-info/METADATA,sha256=XjVrmQgsiQy7HuY5gwgYStUEvbjub1-hH-hh_fm79Bg,3329
3
- my_cloud_devops_consulting-1.1.202507091017.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
- my_cloud_devops_consulting-1.1.202507091017.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
5
- my_cloud_devops_consulting-1.1.202507091017.dist-info/RECORD,,