diff --git a/app/dashboard/templates/dashboard/setting.html b/app/dashboard/templates/dashboard/setting.html index ff1a7ecb..4f35427a 100644 --- a/app/dashboard/templates/dashboard/setting.html +++ b/app/dashboard/templates/dashboard/setting.html @@ -81,6 +81,21 @@ +
+ +

Notifications

+
Do you want to receive our newsletter?
+
+ +
+
+ + +
+
+ +
+

Export Data

diff --git a/app/dashboard/views/setting.py b/app/dashboard/views/setting.py index 22a1f010..c9c59e58 100644 --- a/app/dashboard/views/setting.py +++ b/app/dashboard/views/setting.py @@ -115,6 +115,15 @@ def setting(): elif request.form.get("form-name") == "change-password": send_reset_password_email(current_user) + elif request.form.get("form-name") == "notification-preference": + choose = request.form.get("notification") + if choose == "on": + current_user.notification = True + else: + current_user.notification = False + db.session.commit() + flash("Your notification preference has been updated", "success") + elif request.form.get("form-name") == "delete-account": User.delete(current_user.id) db.session.commit() diff --git a/app/models.py b/app/models.py index 3ed03e2f..1a518568 100644 --- a/app/models.py +++ b/app/models.py @@ -106,6 +106,7 @@ class User(db.Model, ModelMixin, UserMixin): default=AliasGeneratorEnum.word.value, server_default=str(AliasGeneratorEnum.word.value), ) + notification = db.Column(db.Boolean, default=True, nullable=False, server_default=str(True)) activated = db.Column(db.Boolean, default=False, nullable=False)