Skip to content

Commit

Permalink
Pull the brand_identifier from the accounts api. Also fixes for #137, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
bdzim committed Jun 27, 2014
1 parent a0423da commit 0e99f27
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions bin/first_setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

if [ -e /opt/openmanage/etc/.ran_firstsetup ]; then
echo "Keys already generated. Exiting"
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion django/apps/blue_management/blue_mgnt/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>
</a>
</h1>
<ul>
<li>{{ account_info.api_user|title }}</li>
<li>{{ account_info.info.company_name }}</li>
<li>{{ username }}</li>
<li class="line"><a target="_blank" href="https://spideroak.com/business/blue/docs/">
<i class="ss-icon">&#x2753;</i>Help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,16 @@ <h2 class="page-header"><i class="ss-icon">&#x1F464;</i>Add User
[email protected],Jane Doe,Unlimited</pre>
</p>
<p>For additional information, please don't hesitate to reach out to
<a href="mailto:[email protected]">[email protected]</a></p>
{% if features.ldap %}
<a href="mailto:[email protected]">
[email protected]
</a>
{% else %}
<a href="mailto:[email protected]">
[email protected]
</a>
{% endif %}
</p>
</div>
</fieldset>
<div class="widget-actions">
Expand Down
12 changes: 9 additions & 3 deletions django/apps/blue_management/blue_mgnt/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ def initial_setup(username, password):
config_mgr_.config['api_password'] = password
config_mgr_.apply_config()

subprocess.call(['/opt/openmanage/bin/first_setup.sh', username])
api = get_api(config_mgr_.config)

plans = api.list_plans()
unlimited = [x for x in plans if x['storage_bytes'] == 1000000001000000000]
if unlimited:
data = {
'name': 'Default',
'name': info['company_name'],
'plan_id': unlimited[0]['plan_id'],
'webapi_enable': True,
'check_domain': False,
Expand All @@ -285,7 +285,7 @@ def login_user(request):
form = LoginForm(request.POST)
if form.is_valid():
password = form.cleaned_data['password']
username = form.cleaned_data['username']
username = form.cleaned_data['username'].strip()
user = authenticate(username=username,
password=password)
if user and user.is_active:
Expand All @@ -297,6 +297,11 @@ def login_user(request):
if not config['api_password']:
initial_setup(username, password)

config_mgr_ = config_mgr.ConfigManager(config_mgr.default_config())
api = get_api(config_mgr_.config)
subprocess.call(['/opt/openmanage/bin/first_setup.sh',
api.info()['brand_identifier']])

request.session['username'] = username

return redirect('blue_mgnt:index')
Expand Down Expand Up @@ -418,6 +423,7 @@ def new_fun(request, *args, **kwargs):
account_info['total_groups'] = len(config['groups'])
account_info['total_auth_codes'] = models.AdminSetupTokensUse.objects.count()
account_info['api_user'] = config['api_user']
account_info['info'] = api.info()

with open('/opt/openmanage/etc/OpenManage_version.txt') as f:
account_info['version'] = f.readlines()[0]
Expand Down
1 change: 1 addition & 0 deletions django/omva/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''

SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_AGE = 60 * 15

ACCOUNT_API_URL = config['api_root']
Expand Down
5 changes: 5 additions & 0 deletions netkes/account_mgr/accounts_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def list_plans(self):
def quota(self):
return self.client.get_json('partner/quota')

### Info

def info(self):
return self.client.get_json('partner/info')

### Features

def enterprise_features(self):
Expand Down

0 comments on commit 0e99f27

Please sign in to comment.