Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changed api key fieldtype to password in google settings #1355

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions erpnext/stock/doctype/delivery_trip/delivery_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from frappe.contacts.doctype.address.address import get_address_display
from frappe.model.document import Document
from frappe.utils import cint, flt, get_datetime, get_link_to_form, nowdate, today, unique
from frappe.utils.password import get_decrypted_password


class DeliveryTrip(Document):
Expand Down Expand Up @@ -269,13 +270,13 @@ def get_directions(self, route, optimize):
Returns:
(dict): Route legs and, if `optimize` is `True`, optimized waypoint order
"""
if not frappe.db.get_single_value("Google Settings", "api_key"):
if not get_decrypted_password("Google Settings", "Google Settings", "api_key"):
frappe.throw(_("Enter API key in Google Settings."))

import googlemaps

try:
maps_client = googlemaps.Client(key=frappe.db.get_single_value("Google Settings", "api_key"))
maps_client = googlemaps.Client(key=get_decrypted_password("Google Settings", "Google Settings", "api_key"))
except Exception as e:
frappe.throw(e)

Expand Down