Commit ab6db38a authored by Birin Sanchez's avatar Birin Sanchez

Tunnel must not be active by default.

Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent ddeaa588
Pipeline #6104 passed with stage
in 41 seconds
......@@ -188,10 +188,11 @@ class CartRegistrationView(RegistrationView):
for limit in limits:
if limit.service in to_activate:
limit.renewal_date = next_month
limit.is_active = True
# Tunnel special case
# Tunnel special case. Requires user manual activation
if limit.service == settings.LM_SERVICES.TUNNEL:
user.generate_tunnel_account()
limit.is_active = False
else:
limit.is_active = True
limit.save()
user.save()
reward.save()
......
......@@ -95,7 +95,8 @@ class InvitationRegistrationView(RegistrationView):
o_service == settings.LM_SERVICES.TUNNEL and
o_limit.remaining_use_time().total_seconds() > 0
):
user.generate_tunnel_account()
u_limit.is_active = True
# Tunnel activation requires manual
# action from user
u_limit.is_active = False
u_limit.save()
return user
......@@ -118,22 +118,25 @@ def activate_single_limit(limit, credit_timedelta=None, renewal_date=None):
# otherwise, activate the limit before saving
if limit.service == settings.LM_SERVICES.TUNNEL:
if not limit.user.has_tunnel_account():
limit.user.generate_tunnel_account()
# TUNNEL special case requires user manual activation
limit.is_active = False
elif limit.service == settings.LM_SERVICES.CHAT:
limit.user.set_ldap_group("chat")
limit.is_active = True
elif limit.service == settings.LM_SERVICES.MAIL:
limit.user.set_ldap_group("mail")
limit.is_active = True
elif limit.service == settings.LM_SERVICES.SOCIAL:
limit.user.set_ldap_group("social")
limit.is_active = True
elif limit.service == settings.LM_SERVICES.XMPP:
limit.user.set_ldap_group("xmpp")
limit.is_active = True
elif limit.service == settings.LM_SERVICES.GROUP:
pass # Nothing to do for GROUP
limit.is_active = True
else:
raise Exception("Invalid activation attempt. Service not recognised.")
limit.is_active = True
limit.user.chosenreward.is_pending = False
limit.user.chosenreward.save()
limit.save()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment