Esempio n. 1
0
    def post(self):
        email = self.data['email']
        token = User.generate_reset_password_token(email)
        if token is None:
            raise PyError({'msg': 'email_not_found'})

        # Email password reset token to user
        app_name = get_application_id()
        sender = 'noreply@%s.appspotmail.com' % app_name
        subject = '%s password reset' % app_name.capitalize()
        body = """
A password reset has been requested for your account. If you did not request
it, simply ignore this email, otherwise visit this link to reset your password:

https://%s.appspot.com/reset-password/%s
        """ % (app_name, token)
        mail.send_mail(sender, email, subject, body)
        return {'msg': 'reset_link_sent'}
Esempio n. 2
0
File: api.py Progetto: kgov1/pytaku
    def post(self):
        email = self.data['email']
        token = User.generate_reset_password_token(email)
        if token is None:
            raise PyError({'msg': 'email_not_found'})

        # Email password reset token to user
        app_name = get_application_id()
        sender = 'noreply@%s.appspotmail.com' % app_name
        subject = '%s password reset' % app_name.capitalize()
        body = """
A password reset has been requested for your account. If you did not request
it, simply ignore this email, otherwise visit this link to reset your password:

https://%s.appspot.com/reset-password/%s
        """ % (app_name, token)
        mail.send_mail(sender, email, subject, body)
        return {'msg': 'reset_link_sent'}