Commit b7e35bf8 authored by Gert Paimla's avatar Gert Paimla
Browse files

remove change password from landing page

parent 0216b675
{% extends "index.html" %} {% block app %}
{% include 'email-modal.html' %}
<script type="application/javascript" src="{{STATIC_URL}}base/account.js"></script>
<script type="application/javascript" src="{{STATIC_URL}}base/index.js"></script>
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}base/account.css">
<div class="grid-2-col-1-row-default">
<div class="">
{% if request.user.is_authenticated %}
<div class="panel panel-borderless">
{% include 'email-modal.html' %}
<script type="application/javascript" src="{{ STATIC_URL }}base/account.js"></script>
<script type="application/javascript" src="{{ STATIC_URL }}base/index.js"></script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}base/account.css">
<div {% if request.user.is_authenticated %}class="wrapper" {% elif not request.user.is_authenticated %} class="grid-2-col-1-row-default" {% endif %}>
{% if not request.user.is_authenticated %}
<div class="">
<div class="panel-body">
<div class="row padded-row">
<div class="col-sm-12">
<input type="password" class="form-control input-sm" id="new_password" name="new_password" placeholder="New password">
</div>
</div>
<div class="row padded-row">
<div class="col-sm-12">
<input type="password" class="form-control input-sm" id="confirm_new_password" name="confirm_new_password" placeholder="Confirm new password">
</div>
</div>
<div class="row padded-row">
<div class="col-sm-12">
<button type="submit" onclick="javascript:change_pwd();" class="btn btn-default form-control input-sm"><span class="glyphicon glyphicon-ok"></span>
Change Password</button>
</div>
</div>
</div>
</div>
{% else %}
<div class="panel panel-borderless">
<div class="panel-heading">Registration</div>
<div class="panel-body">
<div class='row'>
<div class="col-sm-12">
<form onsubmit="registerAccount(); return false;">
<div class="form-group">
<label for="registrationUsername" class="sr-only">Username</label>
<input type="text" class="form-control input-sm" id="registrationUsername" name="username" placeholder="Username">
</div>
<div class="form-group">
<label for="registrationPassword" class="sr-only">Password</label>
<input type="password" class="form-control input-sm" id="registrationPassword" name="password" placeholder="Password">
</div>
<div class="form-group">
<label for="registrationPasswordAgain" class="sr-only">Password again</label>
<input type="password" class="form-control input-sm" id="registrationPasswordAgain" name="password_again" placeholder="Password again">
</div>
<div class="form-group">
<label for="registrationEmail" class="sr-only">E-mail</label>
<input type="email" class="form-control input-sm" id="registrationEmail" name="email" placeholder="E-mail">
</div>
<!--
<div class="checkbox">
<label><input type="checkbox">Request permissions</label>
</div> -->
<a type="button" class="btn btn-default btn-sm pull-left" href="{% url 'password_reset' %}">Forgot Password</a>
<input type="submit" class="btn btn-default btn-sm pull-right" value="Register">
</form>
</div>
</div>
</div>
</div>
{% endif %}
</div>
<div class="panel panel-borderless">
<div class="panel-heading">Registration</div>
<div class="panel-body">
<div class='row'>
<div class="col-sm-12">
<form onsubmit="registerAccount(); return false;">
<div class="form-group">
<label for="registrationUsername" class="sr-only">Username</label>
<input type="text" class="form-control input-sm" id="registrationUsername"
name="username" placeholder="Username">
</div>
<div class="form-group">
<label for="registrationPassword" class="sr-only">Password</label>
<input type="password" class="form-control input-sm" id="registrationPassword"
name="password" placeholder="Password">
</div>
<div class="form-group">
<label for="registrationPasswordAgain" class="sr-only">Password again</label>
<input type="password" class="form-control input-sm"
id="registrationPasswordAgain" name="password_again"
placeholder="Password again">
</div>
<div class="form-group">
<label for="registrationEmail" class="sr-only">E-mail</label>
<input type="email" class="form-control input-sm" id="registrationEmail"
name="email" placeholder="E-mail">
</div>
<!--
<div class="checkbox">
<label><input type="checkbox">Request permissions</label>
</div> -->
<a type="button" class="btn btn-default btn-sm pull-left"
href="{% url 'password_reset' %}">Forgot Password</a>
<input type="submit" class="btn btn-default btn-sm pull-right" value="Register">
</form>
</div>
</div>
</div>
</div>
<div class="">
<div class="panel panel-borderless">
<div class="panel-body">
</div>
{% endif %}
<div class="">
<div class="panel panel-borderless">
<h3>Documentation for TEXTA Toolkit is available <a href="https://texta-tk.github.io" target="_blank">HERE</a>!</h3>
<br><br>
<div class="row">
<div class="col-lg-5">
<div class="holder">
<img src="{{STATIC_URL}}/img/toolkit_logo.png">
</div>
</div>
<div class="col-lg-4">
<div class="holder">
<img style="width:75%" src="{{STATIC_URL}}/img/ekt_logo.png">
</div>
</div>
</div>
{% if messages %}
{% for message in messages %}
<script type="text/javascript">
swalCustomTypeDisplay('{{message.tags}}','{{message.tags|upper}}!','{{message}}');
</script>
{% endfor %}
{% endif %}
<br><br>
</div>
</div>
</div>
</div>
<div class="panel-body">
<h3>Documentation for TEXTA Toolkit is available <a href="https://texta-tk.github.io"
target="_blank">HERE</a>!</h3>
<br><br>
<div class="row">
<div class="col-lg-5">
<div class="holder">
<img src="{{ STATIC_URL }}/img/toolkit_logo.png">
</div>
</div>
<div class="col-lg-4">
<div class="holder">
<img style="width:75%" src="{{ STATIC_URL }}/img/ekt_logo.png">
</div>
</div>
</div>
{% if messages %}
{% for message in messages %}
<script type="text/javascript">
swalCustomTypeDisplay('{{message.tags}}', '{{message.tags}}!', '{{message}}');
</script>
{% endfor %}
{% endif %}
<br><br>
</div>
</div>
</div>
</div>
{% endblock %}
{% extends "index.html" %} {% block app %}
<script type="application/javascript" src="{{ STATIC_URL }}base/account.js"></script>
{% if request.user.is_authenticated %}
<div class="panel panel-borderless">
<div class="panel-body">
<div class="row padded-row">
<div class="col-sm-12">
<input type="password" class="form-control input-sm" id="new_password" name="new_password" placeholder="New password">
</div>
</div>
<div class="row padded-row">
<div class="col-sm-12">
<input type="password" class="form-control input-sm" id="confirm_new_password" name="confirm_new_password" placeholder="Confirm new password">
</div>
</div>
<div class="row padded-row">
<div class="col-sm-12">
<button type="submit" onclick="javascript:change_pwd();" class="btn btn-default form-control input-sm"><span class="glyphicon glyphicon-ok"></span>
Change Password</button>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
......@@ -11,6 +11,7 @@ urlpatterns = [
url(r'create$', views.create, name="create"),
url(r'login$', views.login, name="login"),
url(r'log_out$', views.log_out, name="log_out"),
url(r'change_pwd$', views.navigate_change_pwd, name="change_pwd"),
url(r'change_password$', views.change_password, name="change_password"),
url(r'get_auth_token$', views.get_auth_token, name="get_auth_token"),
url(r'revoke_auth_token$', views.revoke_auth_token, name="revoke_auth_token"),
......
......@@ -65,7 +65,8 @@ def update_dataset(request):
try:
# TODO: check if is a valid mapping_id before change session[dataset]
new_datasets = parameters.getlist('dataset[]')
new_datasets = [new_dataset for new_dataset in new_datasets if request.user.has_perm('permission_admin.can_access_dataset_' + str(new_dataset))]
new_datasets = [new_dataset for new_dataset in new_datasets if
request.user.has_perm('permission_admin.can_access_dataset_' + str(new_dataset))]
request.session['dataset'] = new_datasets
logger.clean_context()
......@@ -84,7 +85,8 @@ def update_model(request):
logger = LogManager(__name__, 'CHANGE_SETTINGS')
parameters = request.POST
try:
model = {"pk": parameters["model_pk"], "description": parameters["model_description"], "unique_id": parameters["model_uuid"]}
model = {"pk": parameters["model_pk"], "description": parameters["model_description"],
"unique_id": parameters["model_uuid"]}
request.session['model'] = model
logger.clean_context()
logger.set_context('user_name', request.user.username)
......@@ -95,12 +97,13 @@ def update_model(request):
return HttpResponse(json.dumps({'status': 'error'}))
### MANAGING ACCOUNTS ###
def _send_confirmation_email(user, email):
if (REQUIRE_EMAIL_CONFIRMATION):
token = _generate_random_token()
email = EmailMessage('Email Confirmation', 'Please confirm your email by clicking this link:' + URL_PREFIX + '/confirm/' + token, to=[email])
email = EmailMessage('Email Confirmation',
'Please confirm your email by clicking this link:' + URL_PREFIX + '/confirm/' + token,
to=[email])
try:
user.profile
......@@ -135,7 +138,8 @@ def create(request):
if not os.path.exists(user_path):
os.makedirs(user_path)
logging.getLogger(INFO_LOGGER).info("User created", extra={'event': 'create_user', 'user_name': username, 'email': email})
logging.getLogger(INFO_LOGGER).info("User created",
extra={'event': 'create_user', 'user_name': username, 'email': email})
if USER_ISACTIVE_DEFAULT == True:
user = authenticate(username=username, password=password)
......@@ -166,6 +170,13 @@ def validate_form(username, password, email):
return dict(issues)
@login_required
def navigate_change_pwd(request):
template = loader.get_template('reset_password_form.html')
return HttpResponse(
template.render({'STATIC_URL': STATIC_URL}, request))
@login_required
def change_password(request):
user = User.objects.get(username__exact=request.user)
......@@ -186,12 +197,15 @@ def login(request):
django_login(request, user)
log_content = {'event': 'login_process_succeeded', 'user_name': username}
logging.getLogger(INFO_LOGGER).info("Login success", extra=log_content)
return HttpResponse(json.dumps({'task': '*', 'event': 'login_process_succeeded', 'arguments': {'user_name': username}}))
return HttpResponse(
json.dumps({'task': '*', 'event': 'login_process_succeeded', 'arguments': {'user_name': username}}))
else:
log_content = {'event': 'login_process_failed', 'user_name': username}
logging.getLogger(INFO_LOGGER).info("Login failed", extra=log_content)
return HttpResponse(json.dumps({'task': '*', 'event': 'login_process_failed', 'arguments': {'user_name': username}}), status=401)
return HttpResponse(
json.dumps({'task': '*', 'event': 'login_process_failed', 'arguments': {'user_name': username}}),
status=401)
@login_required
......
......@@ -58,9 +58,11 @@
<link rel="shortcut icon" type="image/png" href="{{ STATIC_URL }}/img/favicon.ico"/>
<link rel="stylesheet" href="{{ STATIC_URL }}bootstrap/css/bootstrap-multiselect.css" type="text/css">
<script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.4/css/fixedHeader.dataTables.css"/>
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/fixedheader/3.1.4/css/fixedHeader.dataTables.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/fixedheader/3.1.4/js/dataTables.fixedHeader.js"></script>
<script type="text/javascript"
src="https://cdn.datatables.net/fixedheader/3.1.4/js/dataTables.fixedHeader.js"></script>
<title>TEXTA Toolkit {{ texta_version }}</title>
</head>
......@@ -190,9 +192,12 @@
<li onclick="go_to(LINK_ACCOUNT + '/account/log_out')"
role="button"><a class="account-dropdown-item">
<span class="glyphicon glyphicon-log-out low-opacity margin-right"></span>
Log out</a>
</li>
<li onclick="go_to(LINK_ACCOUNT+ '/change_pwd')" role="button">
<a class="account-dropdown-item"><span class="glyphicon glyphicon-lock low-opacity margin-right"></span>Change Password</a></li>
</ul>
</div>
</div>
......
......@@ -25,7 +25,7 @@ function change_pwd () {
text: 'Password updated!',
type: 'success',
heightAuto: false
}).then((result) => { location.reload() })
}).then((result) => {})
})
} else {
swal({
......
Supports Markdown
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