Ejemplo n.º 1
0
 def post(self):
     try:
         args = parser.parse_args()
         username = args['username']
         password = functions.generate_password_hash(args['password'])
         user_id = functions.check_user_exists(username, password)
         if user_id:
             functions.store_last_login(user_id)
             return functions.get_rest_data_using_user_id(user_id)
         else:
             return {'error': 'You cannot access this page, please check username and password'}
     except AttributeError:
         return {'error': 'Please specify username and password'}
Ejemplo n.º 2
0
 def post(self):
     try:
         args = parser.parse_args()
         username = args['username']
         password = functions.generate_password_hash(args['password'])
         user_id = functions.check_user_exists(username, password)
         if user_id:
             functions.store_last_login(user_id)
             return functions.get_rest_data_using_user_id(user_id)
         else:
             return {
                 'error':
                 'Ne možete pristupiti ovoj stranici, provjerite korisničko ime i zaporku'
             }
     except AttributeError:
         return {'error': 'Navedite korisničko ime i zaporku'}