Browse Source

Merge remote-tracking branch 'origin/master' into dbkr/accept_json

David Baker 7 years ago
parent
commit
c3dd6d9f43
2 changed files with 13 additions and 2 deletions
  1. 5 2
      sydent/sms/openmarket.py
  2. 8 0
      sydent/validators/common.py

+ 5 - 2
sydent/sms/openmarket.py

@@ -24,8 +24,11 @@ from twisted.web.http_headers import Headers
 logger = logging.getLogger(__name__)
 
 
-#API_BASE_URL = "https://smsc.openmarket.com/sms/v4/mt"
-API_BASE_URL = "http://smsc-cie.openmarket.com/sms/v4/mt"
+API_BASE_URL = "https://smsc.openmarket.com/sms/v4/mt"
+# The Customer Integration Environment, where you can send
+# the same requests but it doesn't actually send any SMS.
+# Useful for testing.
+#API_BASE_URL = "http://smsc-cie.openmarket.com/sms/v4/mt"
 
 class OpenMarketSMS:
     def __init__(self, sydent):

+ 8 - 0
sydent/validators/common.py

@@ -9,6 +9,14 @@ logger = logging.getLogger(__name__)
 
 
 def validateSessionWithToken(sydent, sid, clientSecret, token):
+    """
+    Attempt to validate a session, identified by the sid, using
+    the token from out-of-band. The client secret is given to
+    prevent attempts to guess the token for a sid.
+    If the session was sucessfully validated, return a dict
+    with 'success': True that can be sent to the client,
+    otherwise return False.
+    """
     valSessionStore = ThreePidValSessionStore(sydent)
     s = valSessionStore.getTokenSessionById(sid)
     if not s: