woodpecker/pkg/template/pages/user_password.html

84 lines
2.6 KiB
HTML
Raw Normal View History

2014-02-07 10:10:01 +00:00
{{ define "title" }}{{.User.Name}} · Password{{ end }}
{{ define "content" }}
<div class="subhead">
<div class="container">
<ul class="nav nav-tabs pull-right">
<li>
<a href="/dashboard">Dashboard</a>
</li>
<li class="active">
<a href="/account/user/profile">Settings</a>
</li>
</ul> <!-- ./nav -->
<h1 class="user">
<img src="{{.User.Image}}">
<span>{{.User.Name}}</span>
</h1>
</div><!-- ./container -->
</div><!-- ./subhead -->
<div class="container">
<div class="row">
<div class="col-xs-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="/account/user/profile">Profile</a></li>
<li class="active"><a href="/account/user/password">Password</a></li>
<li><a href="/account/user/teams">Teams</a></li>
<li><a href="/account/user/delete">Delete</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main">
<div class="alert">Change your account Password.</div>
<div class="col-xs-5">
<form action="/account/user/password" method="POST" role="form">
<label>New Password:</label>
<div>
<input class="form-control" type="password" name="password" value="">
</div>
<div class="alert alert-success hide" id="successAlert"></div>
<div class="alert alert-error hide" id="failureAlert"></div>
<div class="form-actions">
<input class="btn btn-primary" id="submitButton" type="submit" value="Save" data-loading-text="Saving ..">
<a class="btn btn-default" href="/account/user/password">Cancel</a>
</div>
</form>
</div><!-- ./col-xs-6 -->
</div><!-- ./col-xs-9 -->
</div><!-- ./row -->
</div><!-- ./container -->
{{ end }}
{{ define "script" }}
<script>
document.forms[0].onsubmit = function(event) {
$("#successAlert").hide();
$("#failureAlert").hide();
$('#submitButton').button('loading');
var form = event.target;
var formData = new FormData(form);
xhr = new XMLHttpRequest();
xhr.open('POST', form.action);
xhr.onload = function() {
if (this.status == 200) {
$("#successAlert").text("Your password was successfully changed");
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset');
} else {
$("#failureAlert").text("Failed to update your password. Must be at least 6 chacters long.");
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset');
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}