request['user_hrn'] = user.user_hrn
request['public_key'] = user.public_key
request['private_key'] = user.private_key
+ request['username'] = user.login
return request
def make_request_slice(slice):
if request['type'] == 'user':
try:
- split_email = request['email'].split("@")[0]
- split_email = split_email.replace(".", "_")
- split_authority = request['authority_hrn'].split(".")[1]
- request['username'] = split_email + '@' + split_authority
create_user(wsgi_request, request)
request_status['SFA user'] = {'status': True }
PendingUser.objects.get(id=request['id']).delete()
last_name = request['last_name'],
authority_hrn = request['authority_hrn'],
email = request['email'],
+ login = request['username'],
password = request['password'],
public_key = request['public_key'],
private_key = request['private_key'],
)
b.save()
- split_email = request['email'].split("@")[0]
- split_email = split_email.replace(".", "_")
- split_authority = request['authority_hrn'].split(".")[1]
- request['username'] = split_email + '@' + split_authority
-
# sends email to user to activate the email
theme.template_name = 'activate_user.html'
html_content = render_to_string(theme.template, request)
split_authority_hrn = request['authority_hrn'].split(".")[0]
recipients = authority_get_pi_emails(wsgi_request, split_authority_hrn)
-
+
+ pis = authority_get_pis(request, split_authority_hrn)
+ pi_emails = []
+ for x in pis:
+ for e in x['pi_users']:
+ try:
+ u = e.split(".")[1]
+ y = User.objects.get(username = u)
+ if y.username.count("@") != 0:
+ if y.username.split("@")[1] == request['username'].split("@")[1]:
+ pi_emails += [y.email]
+ except:
+ print "fail"
+
theme.template_name = 'user_request_email.html'
html_content = render_to_string(theme.template, request)
sender = render_to_string(theme.template, request)
sender = sender.replace('\n', '')
- msg = EmailMultiAlternatives(subject, text_content, sender, recipients)
+ msg = EmailMultiAlternatives(subject, text_content, sender, pi_emails)
+
msg.attach_alternative(html_content, "text/html")
msg.send()
except Exception, e:
'theme' : self.theme,
'username': username,
'pi': pi,
- 'section': "Contact"
+ 'section': "Contact",
+ 'email': request.user.username
})
env['theme'] = self.theme
env['section'] = "Dashboard"
- username = request.POST.get('username')
+ username = request.POST.get('username').lower()
password = request.POST.get('password')
# LDAP form - If FIBRE, then get the possibilite to authenticate using usernameldap
from manifold.core.query import Query
from portal.models import PendingUser
+from django.contrib.auth.models import User #Pedro
#from portal.actions import create_pending_user
# Edelberto - LDAP
from portal.actions import create_pending_user, ldap_create_user
'organization' : wsgi_request.POST.get('org_name', ''),
'authority_hrn' : authority_hrn,
'email' : post_email,
+ 'username' : wsgi_request.POST.get('username','').lower(),
'password' : wsgi_request.POST.get('password', ''),
'current_site' : current_site,
'email_hash' : email_hash,
# user_request['user_hrn'] = user_request['authority_hrn'] \
# + '.' + split_email
- split_email = user_request['email'].split("@")[0]
- split_email = split_email.replace(".", "_")
- # Replace + by _ => more convenient for testing and validate with a real email
- split_email = split_email.replace("+", "_")
+ username = user_request['username']
- split_authority = user_request['authority_hrn'].split(".")[1]
- username = split_email + '@' + split_authority
- split_authority = user_request['authority_hrn'].split(".")[0]
- user_request['user_hrn'] = split_authority + '.' + username
+ if user_request['authority_hrn'] == "fibre" :
+ user_request['username'] = user_request['username'] + "@" + "" # to be defined
+ else :
+ split_authority = user_request['authority_hrn'].split(".")[1]
+ user_request['username'] = user_request['username'] + '@' + split_authority
+ split_authority = user_request['authority_hrn'].split(".")[0]
+
+ user_request['user_hrn'] = split_authority + '.' + user_request['username']
# Validate input
UserModel = get_user_model()
errors.append('First name may contain only letters, numbers, spaces and @/./+/-/_ characters.')
if (re.search(r'^[\w+\s.@+-]+$', user_request['last_name']) == None):
errors.append('Last name may contain only letters, numbers, spaces and @/./+/-/_ characters.')
+ if (re.search(r'^[\w,]+$' , username) == None):
+ errors.append('Username may contain only letters,numbers and -/_ characters.')
# checking in django_db !!
if PendingUser.objects.filter(email__iexact = user_request['email']):
errors.append('Email is pending for validation. Please provide a new email address.')
- if UserModel._default_manager.filter(email__iexact = user_request['email']):
- errors.append('This email is not usable. Please contact the administrator or try with another email.')
+ # if UserModel._default_manager.filter(email__iexact = user_request['email']):
+ # errors.append('This email is not usable. Please contact the administrator or try with another email.')
+ if User.objects.filter(username__iexact = user_request['username']):
+ errors.append('This username is already in use, try another one')
# Does the user exist in Manifold?
user_query = Query().get('local:user').select('user_id','email')
user_details = execute_admin_query(wsgi_request, user_query)
user_query = Query().get('user').select('user_hrn','user_email').filter_by('user_hrn','==',user_request['user_hrn'])
user_details_sfa = execute_admin_query(wsgi_request, user_query)
- for user in user_details_sfa:
- if user['user_email'] == user_request['email']:
- errors.append('Email already registered in SFA registry. Please use another email.')
- if user['user_hrn'] == user_request['user_hrn']:
- # add random number if user_hrn already exists in the registry
- user_request['user_hrn'] = user_request['authority_hrn'] \
- + '.' + split_email + str(randint(1,1000000))
+ # for user in user_details_sfa:
+ # if user['user_email'] == user_request['email']:
+ # errors.append('Email already registered in SFA registry. Please use another email.')
+ # if user['user_hrn'] == user_request['user_hrn']:
+ # # add random number if user_hrn already exists in the registry
+ # user_request['user_hrn'] = user_request['authority_hrn'] \
+ # + '.' + split_email + str(randint(1,1000000))
# XXX TODO: Factorize with portal/accountview.py
# XXX TODO: Factorize with portal/registrationview.py
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
{% endif %}
- <div class="form-group" style="color:white;">
- <label for="fed"></label>
- <input type="radio" name="base" value="br" checked>
+ <div class="form-group" style="color:white;">
+ <!--<label for="fed"></label>
+ <input type="radio" name="base" value="br" checked>
<img src="{{ STATIC_URL }}img/fibre/br.png" alt="Brazil" height="32" width="40" />
<input type="radio" name="base" value="eu">
<img src="{{ STATIC_URL }}img/fibre/eu.png" alt="Europe Union" height="32" width="32" />
- <input type="radio" name="base" value="local"> Local User
- </div>
+ <input type="radio" name="base" value="local"> Local User -->
+ </div>
<div class="form-group">
- <label for="username">Email address / Username</label>
- <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ <label for="username">Email Username</label>
+ <input type="text" class="form-control" name="username" placeholder="Enter username">
</div>
<div class="form-group">
<label for="password">Password</label>
<li><a target="_blank" href="http://www.fibre-ict.eu/">Public Website</a></li>
</ul>
{% if username %}
- <div class="account">You are logged in as <a href="/portal/account/">{{ username }}</a> | <a id="logout" style="cursor:pointer;" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</a></div>
+ {% if person.username %}
+ <div class="account">You are logged in as <a href="/portal/account/">{{ person.username }}</a> | <a id="logout" style="cursor:pointer;" data-username="{{ person.username }}"><span class="glyphicon glyphicon-off"></span> Logout</a></div>
+ {% else %}
+ <div class="account"> You are logged in as <a href="/portal/account/">{{ email }}</a> | <a id="logout" style="cursor:pointer;" data-username="{{ email }}"><span class="glyphicon glyphicon-off"></span> Logout</a></div>
+ {% endif %}
{% endif %}
</div>
</div>
</div>
{% endfor %}
<button type="submit" class="btn btn-onelab">Create ticket</button>
+ <button type="button" class="btn btn-onelab" onclick="window.location.href='/'"> Home </button>
</form>
</div>
</div>
<a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a>
</div>
<div>
- <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
+ <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ person.username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
</div>
<div>
{% if person.last_name %}
{{person.first_name}} {{person.last_name}}<br />
{% endif %}
- <span class="label">Username:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
+ <span class="label">Email:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
</div>
</div>
</div>
{% if person.last_name %}
{{person.first_name}} {{person.last_name}}<br />
{% endif %}
- <span class="label">Username:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
+ <span class="label">Email:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
</div>
</div>
</div>
<div>
<button id="deleteusers" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected users</button>
</div>
+ <p></p>
+ <p></p>
+ <div> <button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button> </div>
{% endif %}
</div>
</div>
{% endif %}
<button id="renewslices" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
<button id="deleteslices" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
+ <p></p>
+ <p></p>
+ <div><button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button></div>
</div>
{% endif %}
</div>
{% endif %}
<div class="col-md-12">
<button class="btn btn-onelab" type="button" id="portal__validate" onclick="on_click_event();"><span class="glyphicon glyphicon-ok"></span> Validate</button>
+ <button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button>
</div>
<div class="form-group">
<label for="password" class="control-label">Authentication</label>
<p></p>
- <input type="password" id="password" name="password" class="form-control" style="width:250px" minlength="4" value="{{ password }}"
+ <input type="text" name="username" size="25" class="form-control" style="width:350px" minlength="5" value="{{ username }}" placeholder="Username" required />
+ </div>
+ <div class="form-group">
+ <input type="password" id="password" name="password" class="form-control" style="width:250px" minlength="4" value="{{ password }}"
title="Your password allows you to log in to this portal."
- placeholder="Password" required />
+ placeholder="Password" required />
</div>
<div class="form-group">
<input type="password" id="confirmpassword" name="confirmpassword" style="width:250px" minlength="4" class="form-control" value=""
{value:"{{ authority.name }}",label:"{{authority.name}}"},
{% else %}
{% if authority.authority_hrn == "fibre.ufrj" %}
- {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DO RIO DE JANEIRO"},
- {% else %}
- {value:"{{ authority.authority_hrn }}",label:"FIBRE"},
- {% endif %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DO RIO DE JANEIRO"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.ufg" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DE GOIAS"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.uff" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL FLUMINENSE"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.ufpa" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DO PARA"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.ufpe" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DE PERNAMBUCO"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.ufscar" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE FEDERAL DE SAO CARLOS"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.unifacs" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE SALVADOR"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.usp" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSIDADE DE SAO PAULO"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.cpqd" %}
+ {value:"{{ authority.authority_hrn }}",label:"CENTRO DE PESQUISA E DESENVOLVIMENTO EM TELECOMUNICACOES"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.i2cat" %}
+ {value:"{{ authority.authority_hrn }}",label:"FOUNDATION, RESEARCH AND INNOVATION IN THE INTERNET AREA"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.uth" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSITY OF THESSALY"},
+ {% else %}
+ {% if authority.authority_hrn == "fibre.bristol" %}
+ {value:"{{ authority.authority_hrn }}",label:"UNIVERSITY OF BRISTOL"},
+ {% else %}
+ {value:"{{ authority.authority_hrn }}",label:"FIBRE"},
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
{% endif %}
{% endfor %}
{% else %}
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+<h1><img src="{{ STATIC_URL }}icons/slices-xs.png" alt="Slice" /> Slice request sent</h1>
+
+We will process your request and get back to you as soon as possible.
+<p></p>
+<p></p>
+<button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button>
+
+{% endblock %}
+
--- /dev/null
+{% extends "layout-unfold1.html" %}
+
+{% block unfold_main %}
+
+ <h1>Slice created !</h1>
+
+As you are a PI of the site, you slice has directly been created.
+<p></p>
+<p></p>
+<button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button>
+{% endblock %}
+
</div>
<div class="form-group">
{%if 'is_pi' in pi %}
- <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization"
- title="An authority responsible for vetting your slice" required="required">
+ <input style='display:none' type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization"
+ title="An authority responsible for vetting your slice" required="required" readonly>
{%else%}
- <input type="text" class="form-control" id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;"
+ <input style='display:none' type="text" class="form-control" display=none id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;"
title="An authority responsible for vetting your slice" required="required" readonly>
{%endif%}
</div>
title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
</div>
<button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
+ <button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button>
</form>
</div>
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+<div class="row">
+ <h1><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="User Registration" /> User sign-up</h1>
+</div>
+<div class="row">
+ <h3>Sign up information received.</h3>
+ <p>You can now log in to the portal. You will have limited access. </p>
+ <p>To gain full access, two steps are required:</p>
+ <ul>
+ <li>1. You confirm your signup request by clicking on the link in the email that we have sent to your email address.</li>
+ <li>2. A manager from your organization validates your request. (We have sent email to your organisation's registered managers.)</li>
+ </ul>
+ <p></p>
+ <p></p>
+ <div><button type="button" class="btn btn-onelab" onclick="window.location.href='/'">Home</button></div>
+</div>
+
+{% endblock %}