Repository: fossasia/open-event-server

Issue:
Notify user if he has unverified account



Discussion:

Resolving patch:
diff --git a/open_event/views/admin/models_views/events.py b/open_event/views/admin/models_views/events.py
--- a/open_event/views/admin/models_views/events.py
+++ b/open_event/views/admin/models_views/events.py
@@ -34,6 +34,9 @@ def index_view(self):
         draft_events = DataGetter.get_draft_events()
         past_events = DataGetter.get_past_events()
         all_events = DataGetter.get_all_events()
+        if not is_verified_user():
+            flash("Your account is unverified. "
+                  "Please verify by clicking on the confirmation link that has been emailed to you.")
         return self.render('/gentelella/admin/event/index.html',
                            live_events=live_events,
                            draft_events=draft_events,
@@ -140,7 +143,7 @@ def details_view(self, event_id):
         checklist["5"] = 'success'
         if not is_verified_user():
             flash("To make your event live, please verify your email by "
-                  "clicking on the confirmation link sent to you.")
+                  "clicking on the confirmation link that has been emailed to you.")
         return self.render('/gentelella/admin/event/details/details.html',
                            event=event,
                            checklist=checklist)
@@ -229,7 +232,7 @@ def trash_view(self, event_id):
             event = DataManager.trash_event(event_id)
         flash("Your event has been deleted.", "danger")
         if login.current_user.is_super_admin == True:
-            return redirect(url_for('sadmin_events.index_view'))    
+            return redirect(url_for('sadmin_events.index_view'))
         return redirect(url_for('.index_view'))
 
     @expose('/<event_id>/delete/', methods=('GET',))
diff --git a/open_event/views/admin/models_views/my_sessions.py b/open_event/views/admin/models_views/my_sessions.py
--- a/open_event/views/admin/models_views/my_sessions.py
+++ b/open_event/views/admin/models_views/my_sessions.py
@@ -6,6 +6,7 @@
 from flask_admin import BaseView, expose
 
 from open_event.helpers.data import DataManager
+from open_event.views.admin.models_views.events import is_verified_user
 from ....helpers.data_getter import DataGetter
 
 class MySessionView(BaseView):
@@ -18,6 +19,9 @@ def display_my_sessions_view(self):
         page_content = {"tab_upcoming_events": "Upcoming Sessions",
                         "tab_past_events": "Past Sessions",
                         "title": "My Session Proposals"}
+        if not is_verified_user():
+            flash("Your account is unverified. "
+                  "Please verify by clicking on the confirmation link that has been emailed to you.")
         return self.render('/gentelella/admin/mysessions/mysessions_list.html',
                            upcoming_events_sessions=upcoming_events_sessions, past_events_sessions=past_events_sessions,
                            page_content=page_content)
diff --git a/open_event/views/admin/models_views/profile.py b/open_event/views/admin/models_views/profile.py
--- a/open_event/views/admin/models_views/profile.py
+++ b/open_event/views/admin/models_views/profile.py
@@ -1,13 +1,13 @@
-from flask import request, url_for, redirect, abort
+from flask import request, url_for, redirect, abort, flash
 from flask.ext.admin import BaseView
 from flask_admin import expose
 from flask.ext import login
 
+from open_event.views.admin.models_views.events import is_verified_user
 from ....helpers.data import DataManager
 from ....helpers.data_getter import DataGetter
 from open_event.helpers.storage import upload
 
-
 class ProfileView(BaseView):
 
     def is_accessible(self):
@@ -19,6 +19,9 @@ def _handle_view(self, name, **kwargs):
 
     @expose('/')
     def index_view(self):
+        if not is_verified_user():
+            flash("Your account is unverified. "
+                  "Please verify by clicking on the confirmation link that has been emailed to you.")
         profile = DataGetter.get_user(login.current_user.id)
         return self.render('/gentelella/admin/profile/index.html',
                            profile=profile)


Test patch: