MCPcopy Index your code
hub / github.com/tiny-pilot/tinypilot / auth_post

Function auth_post

app/api.py:239–257  ·  view source on GitHub ↗

Authenticates a user with username and password. Returns: Empty response on success, error object otherwise.

()

Source from the content-addressed store, hash-verified

237@api_blueprint.route('/auth', methods=['POST'])
238@no_auth_required()
239def auth_post():
240 """Authenticates a user with username and password.
241
242 Returns:
243 Empty response on success, error object otherwise.
244 """
245 logger.info_sensitive(
246 'Login request from IP %s',
247 flask.request.headers.get('X-Forwarded-For', flask.request.remote_addr))
248 try:
249 username, password = request_parsers.credentials.parse_credentials(
250 flask.request)
251 except request_parsers.errors.Error as e:
252 return json_response.error(e), 400
253 if auth.can_authenticate(username, password):
254 session.login(username)
255 return json_response.success()
256 return json_response.error(
257 NotAuthenticatedError('Invalid username and password')), 401
258
259
260@api_blueprint.route('/logout', methods=['POST'])

Callers

nothing calls this directly

Calls 3

info_sensitiveMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected