Skip to content
Snippets Groups Projects
Commit b6b22b5a authored by Christian Dresen's avatar Christian Dresen
Browse files

[WarpInfra] Added Register Redirection for internal Page

parent 4e78d06e
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ from warpauth.models import LdapUser, ActivationToken, LdapGroup
from warpauth.util import *
from django.utils.translation import ugettext as _
from django.core.exceptions import ObjectDoesNotExist
from warpzone.settings import INSTANCE_NAME
def send_token(token):
email_content = _("https://infra.warpzone.ms/account/registration/activate/%(token)s") % {'token': token.token }
......@@ -20,6 +20,8 @@ def send_token(token):
def register(request):
page_context['success'] = False
if "INTERN" in INSTANCE_NAME:
return redirect('http://infra.warpzone.ms/registration/')
if request.method == "POST":
username = request.POST['username']
......
......@@ -14,13 +14,16 @@ from warpzone.util import send_email
from warpauth.util import *
from warpauth.models import PasswordResetToken, LdapUser
from warpzone.settings import PW_RESET_TOKEN_LIFETIME
from warpzone.settings import PW_RESET_TOKEN_LIFETIME, INSTANCE_NAME
#
# Function to generate a password reset Token
#
def gen_token(request):
if "INTERN" in INSTANCE_NAME:
return redirect('http://infra.warpzone.ms/reset_password/')
if request.POST:
try:
usr = LdapUser.objects.get(uid=request.POST["username"])
......@@ -45,6 +48,8 @@ def gen_token(request):
#
def change_password(request, reset_hash=None):
if "INTERN" in INSTANCE_NAME:
return redirect('http://infra.warpzone.ms/reset_password/')
try:
pw_reset_token = PasswordResetToken.objects.get(hash=reset_hash)
time_difference = datetime.datetime.now() - pw_reset_token.created
......
......@@ -52,10 +52,11 @@ SECRET_KEY = config.get('security','SECRET_KEY')
API_KEY = config.get('mattermost','API_KEY')
# DEBUG
DEBUG = config.getboolean('debug','DEBUG')
DEBUG = config.getboolean('debug', 'DEBUG')
# MISC
LOG_PATH = config.get('misc','LOG_PATH')
LOG_PATH = config.get('misc', 'LOG_PATH')
INSTANCE_NAME = config.get('common', 'INSTANCE_NAME')
ALLOWED_HOSTS = [config.get('security','ALLOWED_HOSTS')]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment