|
68 |
raise ValueError("SendSMS: UCR umc/self-service/passwordreset/sms/country_code must contain a number.") |
68 |
raise ValueError("SendSMS: UCR umc/self-service/passwordreset/sms/country_code must contain a number.") |
69 |
|
69 |
|
70 |
self.password_file = self.ucr.get("umc/self-service/passwordreset/sms/password_file") |
70 |
self.password_file = self.ucr.get("umc/self-service/passwordreset/sms/password_file") |
71 |
try: |
71 |
if self.password_file: |
72 |
with open(self.password_file) as pw_file: |
72 |
try: |
73 |
self.sms_username, self.sms_password = pw_file.readline().strip().split(":") |
73 |
with open(self.password_file) as pw_file: |
74 |
except ValueError as ve: |
74 |
self.sms_username, self.sms_password = pw_file.readline().strip().split(":") |
75 |
self.log("SendSMS: Format of sms secrets file ({}) is 'username:password'. Error: {}").format(self.password_file, ve) |
75 |
except ValueError as ve: |
76 |
self.log("SendSMS: Format error in sms secrets file ({}): {}".format(self.password_file, ve)) |
76 |
self.log("SendSMS: Format of sms secrets file ({}) is 'username:password'. Error: {}").format(self.password_file, ve) |
77 |
raise |
77 |
self.log("SendSMS: Format error in sms secrets file ({}): {}".format(self.password_file, ve)) |
78 |
except (OSError, IOError) as e: |
78 |
raise |
79 |
self.log("SendSMS: Error reading sms secrets file ({}): {}".format(self.password_file, e)) |
79 |
except (OSError, IOError) as e: |
80 |
raise |
80 |
self.log("SendSMS: Error reading sms secrets file ({}): {}".format(self.password_file, e)) |
|
|
81 |
raise |
82 |
else: |
83 |
self.sms_username, self.sms_password = "", "" |
81 |
|
84 |
|
82 |
@staticmethod |
85 |
@staticmethod |
83 |
def send_method(): |
86 |
def send_method(): |