def set_password(self, cookie, name, password, args): ''' args is a dict with possible keys: type, description, account, expiration expiration must be an integer (days) ''' backend.set_password(cookie, name, password, **args)
def testbackend(): ''' backend ''' import backend as b b.register('dani2', 'pass') assert b.check_user_name('dani2') c = b.auth('dani2', 'password', password='******') b.set_password(c, 'nuevo', 'xxxx', type='email', account='danigm', description="http://mail.danigm.net") p = b.get_password(c, 'nuevo') assert p.name == 'nuevo' b.del_password(c, 'nuevo') p = b.get_passwords_by(c, name='nuevo') assert not p b.unregister(c) assert not b.check_user_name('dani2')
def save(self): backend.set_password(self.user, self.cleaned_data['new_password1']) return self.user