コード例 #1
0
ファイル: auth.py プロジェクト: apiaas/gae-search
 def authenticate(self, username=None, password=None, **kwargs):
     if username and password:
         user = User.get_by_email(username)
         if user and user.check_password(password):
             return user
     # Run the default password hasher once to reduce the timing
     # difference between an existing and a non-existing user
     User(email='*****@*****.**').set_password(password)
コード例 #2
0
ファイル: csv2db.py プロジェクト: ork-a/pan_kanapka
 def import_clients(self):
     with open(self.clients_csv_name, encoding="utf-8") as clients_csv_file:
         csv_reader = csv.reader(clients_csv_file, delimiter=',')
         for email, name, surname, active, company_name, staff, admin in csv_reader:
             client = User()
             client.email = email
             client.name = name
             client.surname = surname
             if staff in ['True', 'true']:
                 client.set_password('admin')
             else:
                 client.set_password('user')
             client.active = active
             company = Company.objects.get(name=company_name)
             client.group = company
             client.staff = staff
             client.save()
コード例 #3
0
ファイル: auth.py プロジェクト: apiaas/gae-search
 def get_user(self, user_id):
     result = User.get_by_id(user_id)
     return result