2015-12-16 07:21:30 +00:00
{% extends "base.html" %}
2018-08-18 15:42:18 +00:00
{% block title %}< title > My Profile - {{ SITE_NAME }}< / title > {% endblock %}
2015-12-16 07:21:30 +00:00
{% block dashboard_stat %}
2016-06-18 04:41:01 +00:00
<!-- Content Header (Page header) -->
2016-05-11 00:03:32 +00:00
< section class = "content-header" >
< h1 >
Profile
< small > Edit my profile< / small >
< / h1 >
< ol class = "breadcrumb" >
< li > < a href = "{{ url_for('dashboard') }}" > < i class = "fa fa-dashboard" > < / i > Home< / a > < / li >
< li class = "active" > My Profile< / li >
< / ol >
< / section >
2015-12-16 07:21:30 +00:00
{% endblock %}
{% block content %}
2016-05-11 00:03:32 +00:00
< section class = "content" >
2016-06-18 04:41:01 +00:00
< div class = "row" >
< div class = "col-lg-12" >
< div class = "box box-primary" >
< div class = "box-header with-border" >
2018-08-22 02:43:33 +00:00
< h3 class = "box-title" > Edit my profile{% if session['authentication_type'] != 'LOCAL' %} [Disabled - Authenticated externally]{% endif %}< / h3 >
2016-06-18 04:41:01 +00:00
< / div >
< div class = "box-body" >
<!-- Custom Tabs -->
< div class = "nav-tabs-custom" id = "tabs" >
< ul class = "nav nav-tabs" >
< li class = "active" > < a href = "#tabs-personal" data-toggle = "tab" > Personal
Info< / a > < / li >
< li > < a href = "#tabs-avatar" data-toggle = "tab" > Change
Avatar< / a > < / li >
2018-08-22 02:43:33 +00:00
{% if session['authentication_type'] == 'LOCAL' %}
< li > < a href = "#tabs-password" data-toggle = "tab" > Change Password< / a > < / li >
{% endif %}
{% if session['authentication_type'] in ['LOCAL', 'LDAP'] %}
< li > < a href = "#tabs-authentication" data-toggle = "tab" > Authentication< / a > < / li >
2018-04-08 02:09:08 +00:00
{% endif %}
2016-06-18 04:41:01 +00:00
< / ul >
< div class = "tab-content" >
< div class = "tab-pane active" id = "tabs-personal" >
< form role = "form" method = "post" action = "{{ user_profile }}" >
2018-11-21 03:24:33 +00:00
< input type = "hidden" name = "_csrf_token" value = "{{ csrf_token() }}" >
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
< label for = "firstname" > First Name< / label > < input type = "text"
class="form-control" name="firstname" id="firstname"
2018-08-22 02:43:33 +00:00
placeholder="{{ current_user.firstname }}" {% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
2016-06-18 04:41:01 +00:00
< / div >
< div class = "form-group" >
< label for = "lastname" > Last Name< / label > < input type = "text"
class="form-control" name="lastname" id="lastname"
2018-08-22 02:43:33 +00:00
placeholder="{{ current_user.lastname }}" {% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
2016-06-18 04:41:01 +00:00
< / div >
< div class = "form-group" >
< label for = "email" > E-mail< / label > < input type = "text"
class="form-control" name="email" id="email"
2018-08-22 02:43:33 +00:00
placeholder="{{ current_user.email }}" {% if session['authentication_type'] != 'LOCAL' %}disabled{% endif %}>
< / div > {% if session['authentication_type'] == 'LOCAL' %}
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
< button type = "submit" class = "btn btn-flat btn-primary" > Submit< / button >
2017-11-01 12:40:26 +00:00
< / div > {% endif %}
2016-06-18 04:41:01 +00:00
< / form >
< / div >
< div class = "tab-pane" id = "tabs-avatar" >
< form action = "{{ user_profile }}" method = "post"
enctype="multipart/form-data">
2018-11-21 03:24:33 +00:00
< input type = "hidden" name = "_csrf_token" value = "{{ csrf_token() }}" >
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
< div class = "form-group" >
< div class = "thumbnail" style = "width: 200px; height: 210px;" >
{% if current_user.avatar %} < img
src="{{ url_for('user_avatar', filename=current_user.avatar) }}"
alt="" / style="width: 200px; height: 200px;"> {%
else %} < img
2016-07-13 14:33:21 +00:00
src="{{ current_user.email|email_to_gravatar_url(size=200) }}"
2016-06-18 04:41:01 +00:00
alt="" /> {% endif %}
2018-08-22 02:43:33 +00:00
< / div > {% if session['authentication_type'] == 'LOCAL' %}
2016-06-18 04:41:01 +00:00
< div >
< label for = "file" > Select image< / label > < input type = "file"
id="file" name="file">
2017-11-01 12:40:26 +00:00
< / div > {% endif %}
2018-08-22 02:43:33 +00:00
< / div > {% if session['authentication_type'] == 'LOCAL' %}
2016-06-18 04:41:01 +00:00
< div >
< span class = "label label-danger" > NOTE! < / span > < span > Only
supports < strong > .PNG, .JPG, .JPEG< / strong > . The best size
to use is < strong > 200x200< / strong > .
< / span >
2017-11-01 12:40:26 +00:00
< / div > {% endif %}
2018-08-22 02:43:33 +00:00
< / div > {% if session['authentication_type'] == 'LOCAL' %}
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
< button type = "submit" class = "btn btn-flat btn-primary" > Submit< / button >
2017-11-01 12:40:26 +00:00
< / div > {% endif %}
2016-06-18 04:41:01 +00:00
< / form >
< / div >
2018-08-22 02:43:33 +00:00
{% if session['authentication_type'] == 'LOCAL' %}
< div class = "tab-pane" id = "tabs-password" >
{% if not current_user.password %}
Your account password is managed via LDAP which isn't supported to change here.
{% else %}
2016-06-18 04:41:01 +00:00
< form action = "{{ user_profile }}" method = "post" >
2018-11-21 03:24:33 +00:00
< input type = "hidden" name = "_csrf_token" value = "{{ csrf_token() }}" >
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
< label for = "password" > New Password< / label > < input
2018-08-22 02:43:33 +00:00
type="password" class="form-control" name="password" id="newpassword"/>
2016-06-18 04:41:01 +00:00
< / div >
< div class = "form-group" >
< label for = "rpassword" > Re-type New Password< / label > < input
2018-08-22 02:43:33 +00:00
type="password" class="form-control" name="rpassword" id="rpassword"/>
2016-06-18 04:41:01 +00:00
< / div >
< div class = "form-group" >
2018-08-22 02:43:33 +00:00
< button type = "submit" class = "btn btn-flat btn-primary" > Change Password< / button >
2016-06-18 04:41:01 +00:00
< / div >
< / form >
{% endif %}
< / div >
2018-08-22 02:43:33 +00:00
{% endif %}
<!-- {% if session['authentication_type'] in ['LOCAL', 'LDAP'] %} -->
2016-06-18 04:41:01 +00:00
< div class = "tab-pane" id = "tabs-authentication" >
< form action = "{{ user_profile }}" method = "post" >
2018-11-21 03:24:33 +00:00
< input type = "hidden" name = "_csrf_token" value = "{{ csrf_token() }}" >
2016-06-18 04:41:01 +00:00
< div class = "form-group" >
2018-08-22 02:43:33 +00:00
< input type = "checkbox" id = "otp_toggle" class = "otp_toggle" { % if current_user . otp_secret % } checked { % endif % } >
2016-06-18 04:41:01 +00:00
< 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('qrcode') }}" > < / p >
Please start FreeOTP (< a target = "_blank" href = "https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp&hl=en" > Android< / a > - < a target = "_blank" href = "https://itunes.apple.com/en/app/freeotp-authenticator/id872559395?mt=8" > iOS< / a > ) on your smartphone and scan the above QR Code with it.
< br / >
< font color = "red" > < strong > < i > Make sure only you can see this QR Code and nobodoy can capture it.< / i > < / strong > < / font >
< / div >
{% endif %}
< / div >
< / form >
2018-08-22 02:43:33 +00:00
< / div >
<!-- {% endif %} -->
2016-06-18 04:41:01 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
< / 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 %}
2018-10-02 07:06:06 +00:00
<!-- TODO: add password and password confirmation comparison check -->
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
$(function() {
$('#tabs').tabs({
// add url anchor tags
activate: function(event, ui) {
window.location.hash = ui.newPanel.attr('id');
}
});
// re-set active tab (ui)
var activeTabIdx = $('#tabs').tabs('option','active');
$('#tabs li:eq('+activeTabIdx+')').tab('show')
});
2016-06-18 04:37:23 +00:00
2016-06-18 04:41:01 +00:00
// initialize pretty checkboxes
$('.otp_toggle').iCheck({
checkboxClass : 'icheckbox_square-blue',
increaseArea : '20%'
});
2016-06-16 08:33:05 +00:00
2016-06-18 04:41:01 +00:00
// handle checkbox toggling
$('.otp_toggle').on('ifToggled', function(event) {
var enable_otp = $(this).prop('checked');
2018-08-31 14:57:52 +00:00
var postdata = {
2016-06-18 04:41:01 +00:00
'action' : 'enable_otp',
'data' : {
'enable_otp' : enable_otp
2018-11-21 03:24:33 +00:00
},
'_csrf_token': '{{ csrf_token() }}'
2016-06-18 04:41:01 +00:00
};
2018-04-01 07:49:40 +00:00
applyChanges(postdata, $SCRIPT_ROOT + '/user/profile', false, true);
2016-06-18 04:41:01 +00:00
});
2016-06-16 08:33:05 +00:00
< / script >
2015-12-16 07:21:30 +00:00
{% endblock %}