Ejemplo n.º 1
0
 def set_password(self, user_id, raw_password):
     from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
     connection = DatabaseWrapper(self.database_settings)
     cursor = connection.cursor()
     password = utils.make_password_hash(raw_password)
     cursor.execute("UPDATE %s SET password=%%s WHERE id=%%s" % self.model._meta.db_table,
         (password, user_id))
     connection._commit()
     connection.close()
Ejemplo n.º 2
0
 def set_password(self, user_id, raw_password):
     from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
     connection = DatabaseWrapper(self.database_settings)
     cursor = connection.cursor()
     password = utils.make_password_hash(raw_password)
     cursor.execute(
         "UPDATE %s SET password=%%s WHERE id=%%s" %
         self.model._meta.db_table, (password, user_id))
     connection._commit()
     connection.close()
Ejemplo n.º 3
0
 def create_user(self, **kwargs):
     from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
     connection = DatabaseWrapper(self.database_settings)
     cursor = connection.cursor()
     opts = self.model._meta
     fields = [f for f in opts.fields if f.name != 'id']
     try:
         kwargs['password'] = utils.make_password_hash(kwargs['password'])
         values = [kwargs[f.name] for f in fields]
     except KeyError, e:
         raise ValueError('Missing field: %s' % e)
Ejemplo n.º 4
0
 def create_user(self, **kwargs):
     from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
     connection = DatabaseWrapper(self.database_settings)
     cursor = connection.cursor()
     opts = self.model._meta
     fields = [f for f in opts.fields if f.name != 'id']
     try:
         kwargs['password'] = utils.make_password_hash(kwargs['password'])
         values = [kwargs[f.name] for f in fields]
     except KeyError, e:
         raise ValueError('Missing field: %s' % e)