def register_teacher(self, location): # bounce existing users to different action if c.user is not None: redirect(location.url(action='register_teacher_existing')) if not hasattr(self, 'form_result'): return htmlfill.render(self._register_teacher_form()) email = self.form_result['email'] if User.get(email, location): h.flash(_('The email you entered is registered in Ututi. ' 'Please login to proceed.')) destination = location.url(action='register_teacher_existing') redirect(url(controller='home', action='login', email=email, came_from=destination)) # lookup/create registration entry and send confirmation code to user registration = UserRegistration.create_or_update(location, email) registration.teacher = True meta.Session.commit() registration.send_confirmation_email() # show confirmation page c.email = email return render('registration/email_approval.mako')
def register(self, location): if not hasattr(self, 'form_result'): return htmlfill.render(self._register_form()) email = self.form_result['email'] # redirect to login if user is registered in this university if User.get(email, location.root): h.flash(_('The email you entered is registered in Ututi. ' 'Please login to proceed.')) redirect(url(controller='home', action='login', email=email)) # lookup/create registration entry and send confirmation code to user registration = UserRegistration.create_or_update(location, email) meta.Session.commit() registration.send_confirmation_email() # show confirmation page c.email = email return render('registration/email_approval.mako')
def _registration_action(self, hash, *args): registration = UserRegistration.get_by_hash(hash) if registration is None or registration.completed: abort(404) c.registration = registration c.steps = [ ('university_info', _("University information")), ('personal_info', _("Personal information")), ('add_photo', _("Add your photo")), ('invite_friends', _("Invite friends")), ] c.active_step = None if registration.location: c.theme = registration.location.get_theme() return method(self, registration, *args)