diff --git a/rhodecode/bin/rhodecode_config.py b/rhodecode/bin/rhodecode_config.py
--- a/rhodecode/bin/rhodecode_config.py
+++ b/rhodecode/bin/rhodecode_config.py
@@ -93,8 +93,6 @@ def _run(argv):
print parser.print_help()
sys.exit(0)
# defaults that can be overwritten by arguments
- from rhodecode.model.license import LicenseModel
- license_token = LicenseModel.generate_license_token()
tmpl_stored_args = {
'http_server': 'waitress',
'lang': 'en',
@@ -102,7 +100,6 @@ def _run(argv):
'host': '127.0.0.1',
'port': 5000,
'error_aggregation_service': None,
- 'license_token': license_token
}
if other:
# parse arguments, we assume only first is correct
diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py
--- a/rhodecode/config/routing.py
+++ b/rhodecode/config/routing.py
@@ -346,11 +346,6 @@ def make_map(config):
m.connect("admin_settings_system_update", "/settings/system/updates",
action="settings_system_update", conditions=dict(method=["GET"]))
- m.connect("admin_settings_license", "/settings/license",
- action="settings_license", conditions=dict(method=["POST"]))
- m.connect("admin_settings_license", "/settings/license",
- action="settings_license", conditions=dict(method=["GET"]))
-
#ADMIN MY ACCOUNT
with rmap.submapper(path_prefix=ADMIN_PREFIX,
controller='admin/my_account') as m:
diff --git a/rhodecode/controllers/admin/settings.py b/rhodecode/controllers/admin/settings.py
--- a/rhodecode/controllers/admin/settings.py
+++ b/rhodecode/controllers/admin/settings.py
@@ -42,7 +42,6 @@ from rhodecode.lib.utils import repo2db_
from rhodecode.model.db import RhodeCodeUi, Repository, RhodeCodeSetting
from rhodecode.model.forms import ApplicationSettingsForm, \
ApplicationUiSettingsForm, ApplicationVisualisationForm
-from rhodecode.model.license import LicenseModel
from rhodecode.model.scm import ScmModel
from rhodecode.model.notification import EmailNotificationModel
from rhodecode.model.meta import Session
@@ -517,63 +516,3 @@ class SettingsController(BaseController)
c.important_notices = latest['general']
return render('admin/settings/settings_system_update.html'),
-
- @HasPermissionAllDecorator('hg.admin')
- def settings_license(self):
- """GET /admin/settings/hooks: All items in the collection"""
- # url('admin_settings_license')
- c.active = 'license'
- if request.POST:
- form_result = request.POST
- try:
- sett1 = RhodeCodeSetting.create_or_update('license_key',
- form_result['rhodecode_license_key'],
- 'unicode')
- Session().add(sett1)
- Session().commit()
- set_rhodecode_config(config)
- h.flash(_('Updated license information'),
- category='success')
-
- except Exception:
- log.error(traceback.format_exc())
- h.flash(_('Error occurred during updating license info'),
- category='error')
-
- return redirect(url('admin_settings_license'))
-
- defaults = RhodeCodeSetting.get_app_settings()
- defaults.update(self._get_hg_ui_settings())
-
- import rhodecode
- c.rhodecode_ini = rhodecode.CONFIG
- c.license_token = c.rhodecode_ini.get('license_token')
- c.generated_license_token = LicenseModel.generate_license_token()
- c.license_info = {}
- c.license_loaded = False
- # try to read info about license
- try:
- license_key = defaults.get('rhodecode_license_key')
- if c.license_token and license_key:
- c.license_info = json.loads(
- LicenseModel(key=c.license_token).decrypt(license_key))
- expires = h.fmt_date(h.time_to_datetime(c.license_info['valid_till']))
- now = time.time()
- if 0 < (c.license_info['valid_till'] - now) < 60*60*24*7:
- h.flash(_('Your license will expire on %s, please contact '
- 'support to extend your license.' % expires), category='warning')
- if c.license_info['valid_till'] - now < 0:
- h.flash(_('Your license has expired on %s, please contact '
- 'support to extend your license.' % expires), category='error')
- c.license_loaded = True
- except Exception, e:
- log.error(traceback.format_exc())
- h.flash(_('Unexpected error while reading license key. Please '
- 'make sure your license token and key are correct'),
- category='error')
-
- return htmlfill.render(
- render('admin/settings/settings.html'),
- defaults=defaults,
- encoding="UTF-8",
- force_defaults=False)
diff --git a/rhodecode/lib/hooks.py b/rhodecode/lib/hooks.py
--- a/rhodecode/lib/hooks.py
+++ b/rhodecode/lib/hooks.py
@@ -258,30 +258,6 @@ def check_allowed_create_user(user_dict,
if not allowed:
raise UserCreationError(reason)
- # license limit hook
- import rhodecode
- from rhodecode.model.license import LicenseModel
- license_token = rhodecode.CONFIG.get('license_token')
- license_key = LicenseModel.get_license_key()
- license_info = LicenseModel.get_license_info(
- license_token=license_token, enc_license_key=license_key,
- fill_defaults=True)
- expiration_check = False
- if expiration_check:
- now = time.time()
- #check expiration
- if now > license_info['valid_till']:
- reason = ('Your license has expired, '
- 'please contact support to extend your license.')
- raise UserCreationError(reason)
- # user count check
- cur_user_count = User.query().count()
- if cur_user_count > int(license_info['users']) > 0:
- reason = ('You have reached the maximum number of users (%s), '
- 'please contact support to extend your license.'
- % license_info['users'])
- raise UserCreationError(reason)
-
def log_create_user(user_dict, created_by, **kwargs):
"""
diff --git a/rhodecode/model/license.py b/rhodecode/model/license.py
deleted file mode 100644
--- a/rhodecode/model/license.py
+++ /dev/null
@@ -1,163 +0,0 @@
-# -*- coding: utf-8 -*-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
%s' % c.rhodecode_ini.get('license_token', _('No license token'))), ''), - ] - if c.license_info: - elems.append((_('License issued to'), '%s %s (%s)' % (c.license_info.get('first_name'),c.license_info.get('last_name'),c.license_info.get('company')), '')) - elems.append((_('License issued on'), h.fmt_date(h.time_to_datetime(c.license_info.get('issue_date'))), '')) - elems.append((_('License users limit'), c.license_info.get('users') if c.license_info.get('users') != -1 else _('unlimited'), '')) - elems.append((_('License expires on'), h.fmt_date(h.time_to_datetime(c.license_info.get('valid_till'))), '')) -%> -%for dt, dd, tt in elems: -
- -<%text>## license token%text> -license_token = ${c.generated_license_token} --