Exemplo n.º 1
0
Arquivo: app.py Projeto: jhsi/tymdrop
    def post(self):
        user_email = self.get_argument('email')
        key = self.get_argument('key', None)
        if key:
            if self.get_secure_cookie('email', key) != user_email:
                self.send_error(400)
                return
            password = self.get_argument('password')
            db.change_user_password(user_email, password)
            self.write({'status':'success'})
            return

        user = db.get_user_by_email(user_email)
        if not user:
            self.render('templates/password_reset_sent.html',
                    {'error':'Are you sure this is the right email address?'})
            return

        reset_email_sender(
            {'user':user,
             'callback_url':'http://www.tymdrop.com/password_reset?email=%s&key=%s' % (user_email, key)},
            dict(
                recipients=[user_email],
                subject='The tymdrop password reset email you requested'))
Exemplo n.º 2
0
Arquivo: db.py Projeto: jhsi/tymdrop
 def test_get_user_by_email(self):
     with mock_user() as user:
         result = db.get_user_by_email(user['email'])
         self.assertEqual(result['id'], user['id'])
         self.assertEqual(result['email'], user['email'])