2015-12-16 07:21:30 +00:00
|
|
|
{% extends "base.html" %}
|
2023-02-06 15:45:13 +00:00
|
|
|
|
2023-02-17 22:25:11 +00:00
|
|
|
{% set active_page = "user_profile" %}
|
|
|
|
|
2023-02-06 15:45:13 +00:00
|
|
|
{% block title %}
|
|
|
|
<title>
|
|
|
|
My Profile - {{ SITE_NAME }}
|
|
|
|
</title>
|
|
|
|
{% endblock %}
|
|
|
|
|
2015-12-16 07:21:30 +00:00
|
|
|
{% block dashboard_stat %}
|
2023-02-06 15:45:13 +00:00
|
|
|
<div class="content-header">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<h1 class="m-0 text-dark">
|
|
|
|
User
|
|
|
|
<small>My Profile</small>
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
|
|
|
<li class="breadcrumb-item active">My Profile</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-16 07:21:30 +00:00
|
|
|
{% endblock %}
|
2023-02-06 15:45:13 +00:00
|
|
|
|
2015-12-16 07:21:30 +00:00
|
|
|
{% block content %}
|
2016-05-11 00:03:32 +00:00
|
|
|
<section class="content">
|
2023-02-14 02:11:13 +00:00
|
|
|
<div class="container-fluid">
|
2016-06-18 04:41:01 +00:00
|
|
|
<div class="row">
|
2023-02-17 22:25:11 +00:00
|
|
|
<div class="col-6">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
2023-02-14 02:11:13 +00:00
|
|
|
<div class="nav-tabs-custom">
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
|
|
<li class="nav-item">
|
2023-02-17 22:25:11 +00:00
|
|
|
<a class="nav-link active" href="#tabs-personal" data-toggle="tab">
|
|
|
|
Personal Info
|
|
|
|
</a>
|
2023-02-14 02:11:13 +00:00
|
|
|
</li>
|
|
|
|
{% if session['authentication_type'] == 'LOCAL' %}
|
|
|
|
<li class="nav-item">
|
2023-02-17 22:25:11 +00:00
|
|
|
<a class="nav-link" href="#tabs-password" data-toggle="tab">
|
|
|
|
Change Password
|
|
|
|
</a>
|
2023-02-14 02:11:13 +00:00
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
{% if session['authentication_type'] in ['LOCAL', 'LDAP'] %}
|
|
|
|
<li class="nav-item">
|
2023-02-17 22:25:11 +00:00
|
|
|
<a class="nav-link" href="#tabs-authentication" data-toggle="tab">
|
|
|
|
Authentication
|
|
|
|
</a>
|
2023-02-14 02:11:13 +00:00
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
</ul>
|
2023-02-17 22:25:11 +00:00
|
|
|
<div class="card-body">
|
2023-02-14 02:11:13 +00:00
|
|
|
<div class="tab-content">
|
|
|
|
<div class="tab-pane fade show active" id="tabs-personal">
|
|
|
|
<form role="form" method="post" action="{{ user_profile }}">
|
|
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="firstname">First Name</label>
|
2023-02-17 22:25:11 +00:00
|
|
|
<input type="text" class="form-control" name="firstname" id="firstname" placeholder="{{ current_user.firstname }}"
|
2023-02-14 02:11:13 +00:00
|
|
|
{% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="lastname">Last Name</label>
|
|
|
|
<input type="text" class="form-control" name="lastname" id="lastname" placeholder="{{ current_user.lastname }}"
|
|
|
|
{% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2023-02-17 22:25:11 +00:00
|
|
|
<label for="email">E-Mail</label> <input type="email" class="form-control" name="email" id="email" placeholder="{{ current_user.email }}"
|
2023-02-14 02:11:13 +00:00
|
|
|
{% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
|
|
|
|
</div>
|
|
|
|
{% if session['authentication_type'] == 'LOCAL' %}
|
|
|
|
<div class="form-group">
|
2023-02-17 22:25:11 +00:00
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<i class="fa-solid fa-floppy-disk"></i> Save
|
|
|
|
</button>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
{% if session['authentication_type'] == 'LOCAL' %}
|
|
|
|
<div class="tab-pane fade" id="tabs-password">
|
|
|
|
{% if not current_user.password %}
|
|
|
|
Your account password is managed via LDAP which isn't supported to change here.
|
|
|
|
{% else %}
|
|
|
|
<form action="{{ user_profile }}" method="post">
|
|
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<div class="form-group">
|
2023-02-17 22:25:11 +00:00
|
|
|
<label for="password">New Password</label>
|
|
|
|
<input type="password" class="form-control" name="password" id="newpassword">
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="rpassword">Re-type New Password</label>
|
|
|
|
<input type="password" class="form-control" name="rpassword" id="rpassword">
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
<div class="form-group">
|
2023-02-17 22:25:11 +00:00
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<i class="fa-solid fa-floppy-disk"></i> Save
|
|
|
|
</button>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="tab-pane fade" id="tabs-authentication">
|
|
|
|
<form action="{{ user_profile }}" method="post">
|
|
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" id="otp_toggle" class="otp_toggle" {% if current_user.otp_secret %}checked{% endif %}>
|
|
|
|
<label for="otp_toggle">Enable Two Factor Authentication</label>
|
|
|
|
{% if current_user.otp_secret %}
|
|
|
|
<div id="token_information">
|
|
|
|
<p>
|
|
|
|
<img id="qrcode" src="{{ url_for('user.qrcode') }}">
|
|
|
|
</p>
|
|
|
|
<div style="position: relative; left: 15px">
|
|
|
|
Your secret key is:
|
|
|
|
<br />
|
|
|
|
<form>
|
|
|
|
<input type=text id="otp_secret" value={{current_user.otp_secret}} readonly>
|
2023-02-17 22:25:11 +00:00
|
|
|
<button type=button style="position:relative; right:28px" onclick="copy_otp_secret_to_clipboard()">
|
|
|
|
<i class="fa-solid fa-clipboard"></i>
|
|
|
|
</button>
|
2023-02-14 02:11:13 +00:00
|
|
|
<br />
|
|
|
|
<font color="red" id="copy_tooltip" style="visibility:collapse">Copied.</font>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
You can use Google Authenticator
|
2023-02-17 22:25:11 +00:00
|
|
|
(<a target="_blank" href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2"><i class="fa-brands fa-google-play"></i>Android</a>
|
|
|
|
- <a target="_blank" href="https://apps.apple.com/us/app/google-authenticator/id388497605"><i class="fa-brands fa-app-store-ios"></i>iOS</a>)
|
2023-02-14 02:11:13 +00:00
|
|
|
or FreeOTP
|
2023-02-17 22:25:11 +00:00
|
|
|
(<a target="_blank" href="https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp&hl=en"><i class="fa-brands fa-google-play"></i>Android</a>
|
|
|
|
- <a target="_blank" href="https://itunes.apple.com/en/app/freeotp-authenticator/id872559395?mt=8"><i class="fa-brands fa-app-store-ios"></i>iOS</a>)
|
2023-02-14 02:11:13 +00:00
|
|
|
on your smartphone to scan the QR code.
|
|
|
|
<br />
|
|
|
|
<font color="red">
|
|
|
|
<strong>
|
|
|
|
<i>Make sure only you can see this QR Code and secret key and
|
|
|
|
nobody can capture them.
|
|
|
|
</i>
|
|
|
|
</strong>
|
|
|
|
</font>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
</form>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-14 02:11:13 +00:00
|
|
|
</div>
|
2016-05-11 00:03:32 +00:00
|
|
|
</section>
|
2015-12-16 07:21:30 +00:00
|
|
|
{% endblock %}
|
2016-05-11 00:03:32 +00:00
|
|
|
{% block extrascripts %}
|
2016-06-16 08:33:05 +00:00
|
|
|
<script>
|
2016-06-18 04:37:23 +00:00
|
|
|
|
2016-06-18 04:41:01 +00:00
|
|
|
// initialize pretty checkboxes
|
|
|
|
$('.otp_toggle').iCheck({
|
2019-12-02 03:32:03 +00:00
|
|
|
checkboxClass: 'icheckbox_square-blue',
|
|
|
|
increaseArea: '20%'
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2016-06-16 08:33:05 +00:00
|
|
|
|
2016-06-18 04:41:01 +00:00
|
|
|
// handle checkbox toggling
|
2023-02-17 22:25:11 +00:00
|
|
|
$('.otp_toggle').on('ifToggled', function(event) {
|
|
|
|
var enable_otp = $(this).prop('checked');
|
|
|
|
var postdata = {
|
|
|
|
'action': 'enable_otp',
|
|
|
|
'data': {
|
|
|
|
'enable_otp': enable_otp
|
|
|
|
},
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
};
|
|
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/user/profile', false, true, function() {
|
|
|
|
window.location.reload();
|
|
|
|
$('#tabs li:eq(2) a').tab('show');
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2023-02-17 22:25:11 +00:00
|
|
|
});
|
2016-06-16 08:33:05 +00:00
|
|
|
</script>
|
2015-12-16 07:21:30 +00:00
|
|
|
{% endblock %}
|