@csrf_exempt
@require_post
@has_request_variables
def api_dev_fetch_api_key(request, username=REQ()):
 if ((not dev_auth_enabled()) or settings.PRODUCTION):
  return json_error(_('Dev environment not enabled.'))
 return_data = {}
 user_profile = authenticate(username=username, realm_subdomain=get_subdomain(request), return_data=return_data)
 if return_data.get('inactive_realm'):
  return json_error(_('Your realm has been deactivated.'), data={'reason': 'realm deactivated'}, status=403)
 if return_data.get('inactive_user'):
  return json_error(_('Your account has been disabled.'), data={'reason': 'user disable'}, status=403)
 login(request, user_profile)
 return json_success({'api_key': user_profile.api_key, 'email': user_profile.email})

@ csrf_exempt @ require_post @ has_request_variables def api_dev_fetch_api_key ( request , username = REQ ( ) ) : if ( ( not dev_auth_enabled ( ) ) or settings . PRODUCTION ) : return json_error ( _ ( 'Dev environment not enabled.' ) ) return_data = { } user_profile = authenticate ( username = username , realm_subdomain = get_subdomain ( request ) , return_data = return_data ) if return_data . get ( 'inactive_realm' ) : return json_error ( _ ( 'Your realm has been deactivated.' ) , data = { 'reason' : 'realm deactivated' } , status = 403 ) if return_data . get ( 'inactive_user' ) : return json_error ( _ ( 'Your account has been disabled.' ) , data = { 'reason' : 'user disable' } , status = 403 ) login ( request , user_profile ) return json_success ( { 'api_key' : user_profile . api_key , 'email' : user_profile . email } )
this function allows logging in without a password on the zulip mobile apps when connecting to a zulip development environment .