summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaio Carrara <ccarrara@thoughtworks.com>2016-05-11 16:24:46 -0300
committerCaio Carrara <ccarrara@thoughtworks.com>2016-05-11 16:24:46 -0300
commitc5f92efdd19464b876e56750f85a6d8ba4d7b558 (patch)
tree27153897785261460f7bd9fa3a7c588eb1d5137a
parenta23d3bebc0c879682f7d70b2a8451cc98b2d70ab (diff)
Remove dispatcher references from service
Since we're not using dispatcher anymore, it doesn't make sense to keep dispatcher references and program flows that depend on it. For example, it doesn't make sense keep the flag --organization-mode, so it was removed as well.
-rw-r--r--service/pixelated/application.py1
-rw-r--r--service/pixelated/assets/welcome.mail21
-rw-r--r--service/pixelated/config/arguments.py3
-rw-r--r--service/pixelated/config/credentials.py16
-rw-r--r--service/pixelated/config/leap.py5
-rw-r--r--service/pixelated/maintenance.py1
-rw-r--r--service/pixelated/resources/features_resource.py12
-rw-r--r--service/test/functional/features/environment.py1
-rw-r--r--service/test/unit/config/test_credentials.py30
-rw-r--r--service/test/unit/test_welcome_mail.py18
10 files changed, 26 insertions, 82 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py
index 98dac541..69af27b9 100644
--- a/service/pixelated/application.py
+++ b/service/pixelated/application.py
@@ -192,7 +192,6 @@ def _start_in_single_user_mode(args, resource, services_factory):
deferred = initialize_leap_single_user(args.leap_provider_cert,
args.leap_provider_cert_fingerprint,
args.credentials_file,
- args.organization_mode,
args.leap_home)
deferred.addCallback(
lambda leap_session: start_user_agent_in_single_user_mode(
diff --git a/service/pixelated/assets/welcome.mail b/service/pixelated/assets/welcome.mail
index 3f233143..8ef4e120 100644
--- a/service/pixelated/assets/welcome.mail
+++ b/service/pixelated/assets/welcome.mail
@@ -15,7 +15,7 @@ Pixelated Mail should provide functionality that is similar to what you've come
To compose a message look for the big blue button on the top left. You can add tags to received messages by clicking on the "+" sign under the message subject. You can also find the encryption status of messages just above the sender/recipient information.
A bit more about Pixelated
-Pixelated is an open source project licensed under AGPL 3.0. It is composed of 3 main parts, the User Agent (what you are using right now), the Dispatcher (what allows you to log in with different accounts to the same instance) and the Platform (which provides the email service you will use to send and receive messages - the server behind the @ sign on your new mail address). You can learn more by visiting https://pixelated-project.org/.
+Pixelated is an open source project licensed under AGPL 3.0. It is composed of 2 main parts, the User Agent (what you are using right now) and the Platform (which provides the email service you will use to send and receive messages - the server behind the @ sign on your new mail address). You can learn more by visiting https://pixelated-project.org/.
About this message and encryption status
This message was not encrypted, in other words, it could have been read by others at some point during transmission, like any other email client.
@@ -30,10 +30,12 @@ Enjoy your secure messaging!
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p>
-Welcome to Pixelated Mail, a modern email with encryption.
+Welcome to Pixelated Mail, a modern email with encryption.
</p>
<p>
-Pixelated Mail is an open source project that aims to provide secure email on the browser with all the functionality we've come to expect of a modern email client.
+Pixelated Mail is an open source project that aims to provide secure email =
+on the browser with all the functionality we've come to expect of a modern =
+email client.
</p>
<p>
<b>How to use it</b><br>
@@ -52,18 +54,17 @@ e sender/recipient information.
<p>
<b>A bit more about Pixelated</b><br>
Pixelated is an open source project licensed under AGPL 3.0. It is composed=
- of 3 main parts, the User Agent (what you are using right now), the Dispat=
-cher (what allows you to log in with different accounts to the same instanc=
-e) and the Platform (which provides the email service you will use to send =
-and receive messages - the server behind the @ sign on your new mail addres=
-s). You can learn more by visiting <a src=3D"https://pixelated-project.org/=
-">https://pixelated-project.org/</a>.
+ of 2 main parts, the User Agent (what you are using right now) and the Pla=
+tform (which provides the email service you will use to send and receive me=
+ssages - the server behind the @ sign on your new mail address). You can le=
+arn more by visiting <a src=3D"https://pixelated-project.org/">https://pixe=
+lated-project.org/</a>.
</p>
<p>
<b>About this message and encryption status</b><br>
This message was not encrypted, in other words, it could have been read by others at some point during transmission like any other email client.
To send encrypted messages you have to have the public Keys of the recipients, in Pixelated you have 2 options:
-<p>- sending an email to another Pixelated account: public keys are exchanged by default.
+<p>- sending an email to another Pixelated account: public keys are exchanged by default.
<br>- sending an email to another email provider: you should had exchanged public keys with the recipients previously.
</p>
<p>
diff --git a/service/pixelated/config/arguments.py b/service/pixelated/config/arguments.py
index abd5d881..d001d803 100644
--- a/service/pixelated/config/arguments.py
+++ b/service/pixelated/config/arguments.py
@@ -24,10 +24,7 @@ def parse_user_agent_args():
parser_add_default_arguments(parser)
parser.add_argument('--host', default='127.0.0.1', help='the host to run the user agent on')
- parser.add_argument('--organization-mode', help='Runs the user agent in organization mode, the credentials will be received from the stdin', default=False, action='store_true', dest='organization_mode')
parser.add_argument('--port', type=int, default=3333, help='the port to run the user agent on')
- parser.add_argument('-sk', '--sslkey', metavar='<server.key>', default=None, help='use specified file as web server\'s SSL key (when using the user-agent together with the pixelated-dispatcher)')
- parser.add_argument('-sc', '--sslcert', metavar='<server.crt>', default=None, help='use specified file as web server\'s SSL certificate (when using the user-agent together with the pixelated-dispatcher)')
parser.add_argument('--multi-user', help='Run user agent in multi user mode', action='store_false', default=True, dest='single_user')
parser.add_argument('-p', '--provider', help='specify a provider for mutli-user mode', metavar='<provider host>', default=None, dest='provider')
parser.add_argument('--banner', help='banner file to show on login screen')
diff --git a/service/pixelated/config/credentials.py b/service/pixelated/config/credentials.py
index a6da86e6..89901b3f 100644
--- a/service/pixelated/config/credentials.py
+++ b/service/pixelated/config/credentials.py
@@ -21,13 +21,10 @@ import sys
import ConfigParser
-def read(organization_mode, credentials_file):
- if organization_mode:
- return read_from_dispatcher()
- else:
- if credentials_file:
- return read_from_file(credentials_file)
- return prompt_for_credentials()
+def read(credentials_file):
+ if credentials_file:
+ return read_from_file(credentials_file)
+ return prompt_for_credentials()
def prompt_for_credentials():
@@ -46,8 +43,3 @@ def read_from_file(credentials_file):
config_parser.get('pixelated', 'leap_username'), \
config_parser.get('pixelated', 'leap_password')
return provider, user, password
-
-
-def read_from_dispatcher():
- config = json.loads(sys.stdin.read())
- return config['leap_provider_hostname'], config['user'], config['password']
diff --git a/service/pixelated/config/leap.py b/service/pixelated/config/leap.py
index 17a69406..f61d3af7 100644
--- a/service/pixelated/config/leap.py
+++ b/service/pixelated/config/leap.py
@@ -30,7 +30,6 @@ def initialize_leap_multi_user(provider_hostname,
leap_provider_cert,
leap_provider_cert_fingerprint,
credentials_file,
- organization_mode,
leap_home):
config, provider = initialize_leap_provider(provider_hostname, leap_provider_cert, leap_provider_cert_fingerprint, leap_home)
@@ -69,15 +68,13 @@ def authenticate_user(provider, username, password, initial_sync=True, auth=None
def initialize_leap_single_user(leap_provider_cert,
leap_provider_cert_fingerprint,
credentials_file,
- organization_mode,
leap_home,
initial_sync=True):
init_monkeypatches()
events_server.ensure_server()
- provider, username, password = credentials.read(organization_mode,
- credentials_file)
+ provider, username, password = credentials.read(credentials_file)
config, provider = initialize_leap_provider(provider, leap_provider_cert, leap_provider_cert_fingerprint, leap_home)
diff --git a/service/pixelated/maintenance.py b/service/pixelated/maintenance.py
index 693e4075..7809b13d 100644
--- a/service/pixelated/maintenance.py
+++ b/service/pixelated/maintenance.py
@@ -47,7 +47,6 @@ def initialize():
args.leap_provider_cert,
args.leap_provider_cert_fingerprint,
args.credentials_file,
- organization_mode=False,
leap_home=args.leap_home,
initial_sync=_do_initial_sync(args))
diff --git a/service/pixelated/resources/features_resource.py b/service/pixelated/resources/features_resource.py
index c8cad2d3..4856b64b 100644
--- a/service/pixelated/resources/features_resource.py
+++ b/service/pixelated/resources/features_resource.py
@@ -30,18 +30,8 @@ class FeaturesResource(Resource):
self._multi_user = multi_user
def render_GET(self, request):
- dispatcher_features = self._dispatcher_features()
disabled_features = self._disabled_features()
- return respond_json(
- {'disabled_features': disabled_features, 'dispatcher_features': dispatcher_features}, request)
-
- def _dispatcher_features(self):
- dispatcher_features = {}
- if os.environ.get('DISPATCHER_LOGOUT_URL'):
- dispatcher_features['logout'] = os.environ.get('DISPATCHER_LOGOUT_URL')
- if self._multi_user:
- dispatcher_features['logout'] = '/%s' % LogoutResource.BASE_URL
- return dispatcher_features
+ return respond_json({'disabled_features': disabled_features}, request)
def _disabled_features(self):
disabled_features = [default_disabled_feature for default_disabled_feature in self.DISABLED_FEATURES]
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index 2c07faf3..41f2c8c7 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -22,7 +22,6 @@ from twisted.internet import defer
from pixelated.application import UserAgentMode
from pixelated.config.site import PixelatedSite
-from test.support.dispatcher.proxy import Proxy
from test.support.integration import AppTestClient
from selenium import webdriver
diff --git a/service/test/unit/config/test_credentials.py b/service/test/unit/config/test_credentials.py
deleted file mode 100644
index 6c25c5bf..00000000
--- a/service/test/unit/config/test_credentials.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import json
-import unittest
-import sys
-from mockito import mock, when
-from pixelated.config import arguments
-from pixelated.config import credentials
-
-
-class TestReadCredentials(unittest.TestCase):
-
- def setUp(self):
- self.test_data = {'leap_provider_hostname': 'test_provider', 'user': 'test_user', 'password': 'test_password'}
-
- def test_organization_mode_reads_credentials_from_stdin(self):
- data = json.dumps({'leap_provider_hostname': 'test_provider', 'user': 'test_user', 'password': 'test_password'})
- orig_stdin = sys.stdin
- sys.stdin = mock()
- when(sys.stdin).read().thenReturn(data)
-
- try:
- sys.argv = ['tmp/does_not_exist', '--organization-mode']
- args = arguments.parse_user_agent_args()
-
- provider, user, password = credentials.read(args.organization_mode, 'not_used')
-
- self.assertEquals('test_provider', provider)
- self.assertEquals('test_user', user)
- self.assertEquals('test_password', password)
- finally:
- sys.stdin = orig_stdin
diff --git a/service/test/unit/test_welcome_mail.py b/service/test/unit/test_welcome_mail.py
index 829740d3..fe2b3005 100644
--- a/service/test/unit/test_welcome_mail.py
+++ b/service/test/unit/test_welcome_mail.py
@@ -15,6 +15,7 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import os
+import re
import unittest
from mockito import verify, mock
from mockito.matchers import Matcher
@@ -61,13 +62,12 @@ class WelcomeMailCapture(Matcher):
def _format(self, mail):
splitter = '\n'
- arr = mail.split(splitter)
- arr = self._remove_variable_value(arr)
+ mail_lines = mail.split(splitter)
+ mail_lines = self._remove_boundaries(mail_lines)
+ return splitter.join(mail_lines)
- return splitter.join(arr)
-
- def _remove_variable_value(self, arr):
- arr.pop(0)
- arr.pop(6)
- arr.pop(44)
- return arr
+ def _remove_boundaries(self, mail_lines):
+ # boundary example --===============5031169581469213585==--
+ boundary_regex = re.compile("^(.*)(\={15})(\w*)(\={2})(.*)$")
+ boundaries = filter(boundary_regex.match, mail_lines)
+ return [line for line in mail_lines if line not in boundaries]