Commit c64a09ff authored by Nelso Jost's avatar Nelso Jost

ADD: show user hash

parent c2535f77
......@@ -102,3 +102,12 @@ class AskPasswordResetForm(Form):
def validate_email(self, field):
if not User.query.filter_by(email=field.data).first():
raise ValidationError('Email não cadastrado!')
class UserDataForm(Form):
user_hash = MyStringField('User Hash', htmlattr={'readonly': True})
def __init__(self):
super().__init__()
self.user_hash.data = current_user.password_hash
......@@ -182,3 +182,9 @@ def ask_password_reset():
return redirect(url_for('auth.login'))
return render_template('auth/askpasswordreset.html', form=form)
@auth.route('/userdata', methods=['GET'])
def show_user_data():
form = UserDataForm()
return render_template('auth/userdata.html', form=form)
{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% block content %}
{{ super() }}
<div class="container">
<div class="page-header">
<h1>Dados do usuário</h1>
</div>
<div class="col-lg-6">
{{ wtf.quick_form(form) }}
</div>
</div>
{% endblock %}
......@@ -21,29 +21,28 @@ $(document).ready(function(){
}
</style>
{% if config.AUTO_PAGE_RELOAD.active %}
<script type=text/javascript>
setInterval(
function()
{
$.getJSON(
'{{ config.AUTO_PAGE_RELOAD.url_need_refresh }}',
{},
function(data)
{
console.log(data);
if (data["need_refresh"])
{
document.location.reload(true);
// window.scrollTo(0, document.body.scrollHeight + 1000);
window.scrollTo(0,readCookie('ypos'));
}
}
);
},
{{ config.AUTO_PAGE_RELOAD.interval }});
</script>
{% endif %}
<!-- <script type=text/javascript> -->
<!-- setInterval( -->
<!-- function() -->
<!-- { -->
<!-- $.getJSON( -->
<!-- 'xxx', -->
<!-- {}, -->
<!-- function(data) -->
<!-- { -->
<!-- console.log(data); -->
<!-- if (data["need_refresh"]) -->
<!-- { -->
<!-- document.location.reload(true); -->
<!-- // window.scrollTo(0, document.body.scrollHeight + 1000); -->
<!-- window.scrollTo(0,readCookie('ypos')); -->
<!-- } -->
<!-- } -->
<!-- ); -->
<!-- }, -->
<!-- xxx); -->
<!-- </script> -->
<!-- http://www.webdeveloper.com/forum/showthread.php?58146-Keeping-Scrollbar-Position-On-Refresh -->
<script language="JavaScript">
......@@ -56,7 +55,7 @@ return(document.cookie.match('(^|; )'+name+'=([^;]*)')||0)[2]
{% block body_attribs %}
onScroll=\"document.cookie='ypos=' + window.pageYOffset\" \"
{% endblock %}
{% block navbar %}
<div class="navbar navbar-inverse" role="navigation">
<div class="container">
......@@ -106,7 +105,8 @@ onScroll=\"document.cookie='ypos=' + window.pageYOffset\" \"
role="button" aria-haspopup="true" aria-expanded="false"
>[ {{ current_user.username }} ]<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Meus dados</a></li>
<li><a href={{ url_for('auth.show_user_data') }}
>Meus dados</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ url_for('auth.change_email') }}"
>Alterar e-mail</a></li>
......
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