Skip to content

Commit

Permalink
Fix layout of change password view. Do not allow user to reset passwo…
Browse files Browse the repository at this point in the history
…rd if logged-in. Logging when email sending fails.
  • Loading branch information
mazz committed Mar 25, 2015
1 parent 6f7ff02 commit bfdacb5
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 27 deletions.
4 changes: 3 additions & 1 deletion queue/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def email_signup_user(email, msg, settings, message_data):
from ~~~PROJNAME~~~.lib.msg import SignupMsg
msg = SignupMsg(email, msg, settings)
status = msg.send(message_data)
LOG.info('email sending status: ' + repr(status))

if status == 4:
# from bookie.lib.applog import SignupLog
from foo.lib.applog import SignupLog
trans = transaction.begin()
LOG.info('Could not send smtp email to signup: ' + email)
trans.commit()
Expand Down
86 changes: 60 additions & 26 deletions templates/auth/reset.mako
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
##
##${password_reset(user, reset=True)}

<%
date_fmt = "%m/%d/%Y"
%>

<script type="text/javascript">
$(document).ready(function() {
Expand Down Expand Up @@ -68,14 +71,20 @@
</script>

<div class="container">
<div class="row">
<div class="col-sm-12">
<h1>Change Password</h1>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div id="page-wrapper">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 class="page-header">Update Account</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-4 col-md-offset-2">
<!-- /.panel -->
<!-- /.panel -->
<!-- <div class="panel panel-default"> -->
<!-- /.panel-heading -->
% if message is not '':
<div class="alert alert-danger" role="alert" alert-dismissable>
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
Expand All @@ -90,24 +99,49 @@
<input type="hidden" name="username" id="username" value="${user.username}" />
<input type="hidden" name="code" id="code" value="${user.activation.code}" />
<input type="password" class="input-lg form-control" name="password1" id="password1" placeholder="New Password" autocomplete="off">
<div class="row">
<div class="col-sm-6">
<span id="8char" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> 8 Characters Long<br>
<span id="ucase" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> One Uppercase Letter
</div>
<div class="col-sm-6">
<span id="lcase" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> One Lowercase Letter<br>
<span id="num" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> One Number
</div>
</div>
</br>
<input type="password" class="input-lg form-control" name="password2" id="password2" placeholder="Repeat Password" autocomplete="off">
<div class="row">
<div class="col-sm-12">
<span id="pwmatch" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> Passwords Match
</div>
</div>
</br>
<input type="submit" class="col-xs-12 btn btn-primary btn-load btn-lg" data-loading-text="Changing Password..." value="Change Password">
</form>
</div><!--/col-sm-6-->
</div><!--/row-->
</div>
<!-- </div> -->
<!-- /.panel -->
</div>
<!-- /.col-lg-8 -->
<div class="col-lg-4">
<!-- /.panel-heading -->
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item">
<i class="fa fa-comment fa-fw"></i> 8 Characters Long
<span id="8char" class="pull-right glyphicon glyphicon-remove" style="color:#FF0004;"></span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-twitter fa-fw"></i> One Uppercase Letter
<span id="ucase" class="pull-right glyphicon glyphicon-remove" style="color:#FF0004;"></span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-envelope fa-fw"></i> One Lowercase Letter
<span id="lcase" class="pull-right glyphicon glyphicon-remove" style="color:#FF0004;"></span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-tasks fa-fw"></i> One Number
<span id="num" class="pull-right glyphicon glyphicon-remove" style="color:#FF0004;"></span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-upload fa-fw"></i> Passwords Match
<span id="pwmatch" class="pull-right glyphicon glyphicon-remove" style="color:#FF0004;"></span>
</a>
</div>
<!-- /.list-group -->
</div>
<!-- /.panel-body -->
<!-- /.panel -->
<!-- /.panel -->
<!-- /.panel .chat-panel -->
</div>
<!-- /.col-lg-4 -->
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
11 changes: 11 additions & 0 deletions views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def login(request):
things this way
"""

# in case they're already logged-in just send them to their profile page for now
if request.user:
headers = remember(request, request.user.id, max_age=max_cookie_age)
return HTTPFound(location=request.route_url('user_account', username=request.user.username),headers=headers)

login_url = route_url('login', request)
referrer = request.url
if referrer == login_url:
Expand Down Expand Up @@ -203,6 +209,11 @@ def forgot_password(request):
things this way
"""
# in case they're already logged-in just send them to their profile page for now
if request.user:
headers = remember(request, request.user.id, max_age=max_cookie_age)
return HTTPFound(location=request.route_url('user_account', username=request.user.username),headers=headers)

fp_url = route_url('forgot_password', request)
referrer = request.url
if referrer == fp_url:
Expand Down

0 comments on commit bfdacb5

Please sign in to comment.