1 from unfold.loginrequired import FreeAccessView
3 from manifold.core.query import Query
4 from manifoldapi.manifoldapi import execute_query, execute_admin_query
5 from portal.actions import manifold_update_user, manifold_update_account, manifold_add_account, manifold_delete_account, sfa_update_user
7 from unfold.page import Page
8 from ui.topmenu import topmenu_items_live, the_user
10 from django.http import HttpResponse, HttpResponseRedirect
11 from django.contrib import messages
12 from django.contrib.auth.decorators import login_required
13 from myslice.theme import ThemeView
14 from portal.models import PendingUser
16 import json, os, re, itertools
19 class ActivateEmailView(FreeAccessView, ThemeView):
20 template_name = "email_activation.html"
21 def dispatch(self, *args, **kwargs):
22 return super(ActivateEmailView, self).dispatch(*args, **kwargs)
25 def get_context_data(self, **kwargs):
27 page = Page(self.request)
28 #page.add_js_files ( [ "js/jquery.validate.js", "js/my_account.register.js", "js/my_account.edit_profile.js" ] )
29 #page.add_css_files ( [ "css/onelab.css", "css/account_view.css","css/plugin.css" ] )
31 for key, value in kwargs.iteritems():
32 #print "%s = %s" % (key, value)
33 if key == "hash_code":
36 if PendingUser.objects.filter(email_hash__iexact = hash_code):
37 #get_user = PendingUser.objects.filter(email_hash__iexact = hash_code)
38 #get_user.status= 'True'
40 PendingUser.objects.filter(email_hash__iexact = hash_code).update(status='True')
41 activation = 'success'
45 context = super(ActivateEmailView, self).get_context_data(**kwargs)
46 context['activation_status'] = activation
47 # XXX This is repeated in all pages
48 # more general variables expected in the template
49 context['title'] = 'Platforms connected to MySlice'
50 # the menu items on the top
51 context['topmenu_items'] = topmenu_items_live('My Account', page)
52 # so we can sho who is logged
53 context['username'] = the_user(self.request)
54 context['theme'] = self.theme
55 # context ['firstname'] = config['firstname']
56 prelude_env = page.prelude_env()
57 context.update(prelude_env)