Beispiel #1
0
    def testCryptographicSecurity(self):
        # Make sure we are not using the normal random to generate tokens
        random.seed(1)
        token1 = genToken()
        random.seed(1)
        token2 = genToken()

        self.assertNotEqual(token1, token2)
Beispiel #2
0
    def testCryptographicSecurity(self):
        # Make sure we are not using the normal random to generate tokens
        random.seed(1)
        token1 = genToken()
        random.seed(1)
        token2 = genToken()

        self.assertNotEqual(token1, token2)
Beispiel #3
0
def testTokenGenerationIsUnaffectedByNormalRandom():
    # Make sure we are not using the normal random to generate tokens
    random.seed(1)
    token1 = genToken()
    random.seed(1)
    token2 = genToken()

    assert token1 != token2
Beispiel #4
0
    def resetPassword(self, email, params):
        user = self.model('user').findOne({'email': email.lower()})
        if user is None:
            raise RestException('That email is not registered.')

        randomPass = genToken(length=12)

        html = mail_utils.renderTemplate('resetPassword.mako', {
            'password': randomPass
        })
        mail_utils.sendEmail(to=email, subject='Girder: Password reset', text=html)
        self.model('user').setPassword(user, randomPass)
        return {'message': 'Sent password reset email.'}
Beispiel #5
0
    def resetPassword(self, email):
        user = self.model('user').findOne({'email': email.lower()})
        if user is None:
            raise RestException('That email is not registered.')

        randomPass = genToken(length=12)

        html = mail_utils.renderTemplate('resetPassword.mako', {
            'password': randomPass
        })
        mail_utils.sendEmail(to=email, subject='Girder: Password reset', text=html)
        self.model('user').setPassword(user, randomPass)
        return {'message': 'Sent password reset email.'}
Beispiel #6
0
    def resetPassword(self, params):
        self.requireParams(('email',), params)
        email = params['email'].lower().strip()

        cursor = self.model('user').find({'email': email}, limit=1)
        if cursor.count() == 0:
            raise RestException('That email is not registered.')

        user = cursor.next()
        randomPass = genToken(length=12)

        html = mail_utils.renderTemplate('resetPassword.mako', {
            'password': randomPass
        })
        mail_utils.sendEmail(to=email, subject='Girder: Password reset',
                             text=html)
        self.model('user').setPassword(user, randomPass)
        return {'message': 'Sent password reset email.'}
Beispiel #7
0
    def resetPassword(self, params):
        self.requireParams('email', params)
        email = params['email'].lower().strip()

        cursor = self.model('user').find({'email': email}, limit=1)
        if cursor.count() == 0:
            raise RestException('That email is not registered.')

        user = cursor.next()
        randomPass = genToken(length=12)

        html = mail_utils.renderTemplate('resetPassword.mako',
                                         {'password': randomPass})
        mail_utils.sendEmail(to=email,
                             subject='Girder: Password reset',
                             text=html)
        self.model('user').setPassword(user, randomPass)
        return {'message': 'Sent password reset email.'}