Esempio n. 1
0
    def add_success(self, emailform):
        newemail = self.schema.serialize(emailform)

        # We need to add the new email to the emails list

        emails = self.user.get_mail_aliases()

        mailsubdoc = {
            'email': newemail['mail'],
            'verified': False,
            'added_timestamp': datetime.utcnow()
        }

        emails.append(mailsubdoc)

        self.user.set_mail_aliases(emails)
        try:
            self.user.save(self.request)
        except UserOutOfSync:
            self.sync_user()

        else:
            message = _('Changes saved')
            self.request.session.flash(get_localizer(self.request).translate(message), queue='forms')

            send_verification_mail(self.request, newemail['mail'])

            second_msg = _('A confirmation email has been sent to your email '
                    'address. Please enter your confirmation code '
                    '<a href="#" class="verifycode" '
                    'data-identifier="${id}">here</a>.', mapping={'id': len(emails)})
            self.request.session.flash(get_localizer(self.request).translate(second_msg), queue='forms')
Esempio n. 2
0
    def add_success(self, emailform):
        newemail = self.schema.serialize(emailform)

        new_email = MailAddress(email=newemail['mail'],
                application='dashboard',
                verified=False, primary=False)

        self.user = get_session_user(self.request)
        self.user.mail_addresses.add(new_email)
        try:
            self.context.save_dashboard_user(self.user)
        except UserOutOfSync:
            self.sync_user()

        else:
            message = _('Changes saved')
            self.request.session.flash(get_localizer(self.request).translate(message), queue='forms')

            send_verification_mail(self.request, newemail['mail'])

            second_msg = _('A confirmation email has been sent to your email '
                    'address. Please enter your confirmation code '
                    '<a href="#" class="verifycode" '
                    'data-identifier="${id}">here</a>.', mapping={'id': self.user.mail_addresses.count})
            self.request.session.flash(get_localizer(self.request).translate(second_msg), queue='forms')
Esempio n. 3
0
    def add_success(self, emailform):
        newemail = self.schema.serialize(emailform)

        # We need to add the new email to the emails list

        emails = self.user.get_mail_aliases()

        mailsubdoc = {
            'email': newemail['mail'],
            'verified': False,
        }

        emails.append(mailsubdoc)

        self.user.set_mail_aliases(emails)
        self.user.save(self.request)

        self.request.session.flash(_('Changes saved'),
                                   queue='forms')

        send_verification_mail(self.request, newemail['mail'])

        self.request.session.flash(_('A confirmation email has been sent to your email address. '
                                     'Please enter your confirmation code <a href="#" class="verifycode" data-identifier="${id}">here</a>.',
                                     mapping={'id': len(emails)}),
                                   queue='forms')
Esempio n. 4
0
    def add_success(self, emailform):
        newemail = self.schema.serialize(emailform)

        new_email = MailAddress(email=newemail['mail'],
                                application='dashboard',
                                verified=False,
                                primary=False)

        self.user = get_session_user(self.request)
        self.user.mail_addresses.add(new_email)
        try:
            self.context.save_dashboard_user(self.user)
        except UserOutOfSync:
            self.sync_user()

        else:
            message = _('Changes saved')
            self.request.session.flash(get_localizer(
                self.request).translate(message),
                                       queue='forms')

            send_verification_mail(self.request, newemail['mail'])

            second_msg = _(
                'A confirmation email has been sent to your email '
                'address. Please enter your confirmation code '
                '<a href="#" class="verifycode" '
                'data-identifier="${id}">here</a>.',
                mapping={'id': self.user.mail_addresses.count})
            self.request.session.flash(get_localizer(
                self.request).translate(second_msg),
                                       queue='forms')
Esempio n. 5
0
 def send_verification_code(self, data_id, reference, code):
     send_verification_mail(self.request, data_id, reference, code)
Esempio n. 6
0
 def send_verification_code(self, data_id, reference, code):
     send_verification_mail(self.request, data_id, reference, code)