mirror of
https://github.com/Luzifer/cloudkeys-go.git
synced 2024-11-08 14:10:05 +00:00
Merge branch 'rosetree-feature/edit_enc_pw'
This commit is contained in:
commit
9888a31eb4
9 changed files with 136 additions and 33 deletions
2
Makefile
2
Makefile
|
@ -11,7 +11,7 @@ container: bindata.go
|
|||
docker build .
|
||||
|
||||
gen_css:
|
||||
lessc --verbose -O2 -x less/*.less assets/style.css
|
||||
lessc --verbose -x less/*.less assets/style.css
|
||||
|
||||
gen_js:
|
||||
coffee --compile -o assets coffee/*.coffee
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 1.10.0
|
||||
// Generated by CoffeeScript 1.12.2
|
||||
(function() {
|
||||
var CloudKeys;
|
||||
|
||||
|
@ -17,6 +17,9 @@
|
|||
$('#newEntityLink').click(function() {
|
||||
return _this.showForm();
|
||||
});
|
||||
$('#editEncPWLink').click(function() {
|
||||
return _this.showEditEncPWForm();
|
||||
});
|
||||
$('#passwordRequest').addClass('hide');
|
||||
$('#search').keyup(function() {
|
||||
var that = this;
|
||||
|
@ -119,7 +122,7 @@
|
|||
};
|
||||
|
||||
CloudKeys.prototype.updateInformation = function(data) {
|
||||
var e, error;
|
||||
var e;
|
||||
this.version = data.version;
|
||||
if (data.data === "") {
|
||||
this.entities = [];
|
||||
|
@ -365,6 +368,40 @@
|
|||
return success;
|
||||
};
|
||||
|
||||
CloudKeys.prototype.showEditEncPWForm = function() {
|
||||
$('#editEncPWDialog input').val('');
|
||||
$('#editEncPWDialog .hide').removeClass('hide');
|
||||
$('#editEncPWDialog').modal({});
|
||||
return $('#editEncPWDialog .btn-primary').unbind('click').click((function(_this) {
|
||||
return function() {
|
||||
var confirmation, new_password;
|
||||
$('#editEncPWDialog .has-error').removeClass('has-error');
|
||||
confirmation = confirm('Do you really want to update your encryption password?');
|
||||
if (confirmation !== true) {
|
||||
return;
|
||||
}
|
||||
if ($('#editEncPW_current_password').val() !== _this.password) {
|
||||
$('#editEncPW_current_password').parent().addClass('has-error');
|
||||
return;
|
||||
}
|
||||
new_password = $('#editEncPW_password').val();
|
||||
if (new_password === void 0 || new_password === '') {
|
||||
$('#editEncPW_password').parent().addClass('has-error');
|
||||
return;
|
||||
}
|
||||
if (new_password !== $('#editEncPW_repeat_password').val()) {
|
||||
$('#editEncPW_password, #editEncPW_repeat_password').parent().addClass('has-error');
|
||||
return;
|
||||
}
|
||||
_this.password = new_password;
|
||||
_this.updateData(function() {
|
||||
$('#formEncPWClose').click();
|
||||
return alert('Your encryption password has been changed. Keep this in mind for later.');
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
return CloudKeys;
|
||||
|
||||
})();
|
||||
|
|
|
@ -1 +1 @@
|
|||
body{padding-top:70px}input{outline:0}.navbar a{cursor:pointer}.navbar a.active_account{font-weight:700}#importContainer{display:none}#importContainer #importer{border:1px solid #111;border-radius:5px;background-image:linear-gradient(to bottom,#666 0,#171717 100%);margin:20px 0;padding:20px 20px}#importContainer #importer textarea{border:0;border-radius:5px;display:block;font-size:11px;height:350px;margin:0 auto;padding:0;width:100%}#loader img{display:block;margin:0 auto}#searchbox{border:1px solid #111;border-radius:5px;background-image:linear-gradient(to bottom,#666 0,#171717 100%);margin:20px 0;padding:10px}#searchbox input{border:0;border-radius:5px;display:block;font-size:20px;height:40px;margin:0 auto;padding:0 20px;width:100%}#content #resultdescription{margin:15px 0}#content #resultdescription span{font-weight:700}#content ul#items{list-style:none;padding:0}#content ul#items li.active{background-color:#e5e3e9}#content ul#items li{cursor:pointer;padding:5px 20px}#content ul#items li span{font-size:70%;font-style:italic;padding:0 0 0 20px}#content ul#items li ul{display:none;list-style:none;padding-left:5px}#content ul#items li ul li.last{display:none}@media (min-width:768px){#content ul#items li ul li.last{border-bottom:0;display:block}}#content ul#items li ul li{border-bottom:1px dotted gray}#content ul#items li ul li br{clear:both}#content ul#items li ul li label{display:block;float:left;width:100px}#content ul#items li ul li input,#content ul#items li ul li textarea{background:0 0;border:0;float:left;font-size:11px;min-height:20px;outline:0;padding-left:0;width:300px}#content ul#items li ul li input.password{width:200px}#content ul#items li ul li div.clipboard{background:url(clipboard.png) no-repeat top left;display:inline-block;height:14px;width:14px}#content ul#items li ul li div.clipboard:active{background:url(clipboard_click.png) no-repeat top left}#content ul#items li ul li div.clipboard:hover{background:url(clipboard_hover.png) no-repeat top left}#content ul#items li ul li em{float:left;font-size:70%;width:100px}#content ul#items li ul li span.clippy{display:none}@media (min-width:992px){#content ul#items li ul li span.clippy{display:block;float:left;padding-left:0;width:20px}}#content ul#items li li.odd{background-color:transparent}#content ul#items li:hover{background-color:#e5e3e9}#content ul#items li.odd{background-color:#f6f6f6}
|
||||
body{padding-top:70px}input{outline:0}.navbar a{cursor:pointer}.navbar a.active_account{font-weight:bold}#importContainer{display:none}#importContainer #importer{border:1px solid #111111;border-radius:5px;background-image:linear-gradient(to bottom, #666666 0, #171717 100%);margin:20px 0;padding:20px 20px}#importContainer #importer textarea{border:0;border-radius:5px;display:block;font-size:11px;height:350px;margin:0 auto;padding:0;width:100%}#loader img{display:block;margin:0 auto}#searchbox{border:1px solid #111111;border-radius:5px;background-image:linear-gradient(to bottom, #666666 0, #171717 100%);margin:20px 0;padding:10px}#searchbox input{border:0;border-radius:5px;display:block;font-size:20px;height:40px;margin:0 auto;padding:0 20px;width:100%}#content #resultdescription{margin:15px 0}#content #resultdescription span{font-weight:bold}#content ul#items{list-style:none;padding:0}#content ul#items li.active{background-color:#e5e3e9}#content ul#items li{cursor:pointer;padding:5px 20px}#content ul#items li span{font-size:70%;font-style:italic;padding:0 0 0 20px}#content ul#items li ul{display:none;list-style:none;padding-left:5px}#content ul#items li ul li.last{display:none}@media (min-width:768px){#content ul#items li ul li.last{border-bottom:0;display:block}}#content ul#items li ul li{border-bottom:1px dotted gray}#content ul#items li ul li br{clear:both}#content ul#items li ul li label{display:block;float:left;width:100px}#content ul#items li ul li input,#content ul#items li ul li textarea{background:transparent;border:0;float:left;font-size:11px;min-height:20px;outline:0;padding-left:0;width:300px}#content ul#items li ul li input.password{width:200px}#content ul#items li ul li div.clipboard{background:url('clipboard.png') no-repeat top left;display:inline-block;height:14px;width:14px}#content ul#items li ul li div.clipboard:active{background:url('clipboard_click.png') no-repeat top left}#content ul#items li ul li div.clipboard:hover{background:url('clipboard_hover.png') no-repeat top left}#content ul#items li ul li em{float:left;font-size:70%;width:100px}#content ul#items li ul li span.clippy{display:none}@media (min-width:992px){#content ul#items li ul li span.clippy{display:block;float:left;padding-left:0;width:20px}}#content ul#items li li.odd{background-color:transparent}#content ul#items li:hover{background-color:#e5e3e9}#content ul#items li.odd{background-color:#f6f6f6}
|
22
bindata.go
22
bindata.go
File diff suppressed because one or more lines are too long
|
@ -13,6 +13,8 @@ class CloudKeys
|
|||
@fetchData()
|
||||
$('#newEntityLink').click =>
|
||||
@showForm()
|
||||
$('#editEncPWLink').click =>
|
||||
@showEditEncPWForm()
|
||||
|
||||
$('#passwordRequest').addClass('hide')
|
||||
|
||||
|
@ -282,6 +284,39 @@ class CloudKeys
|
|||
|
||||
return success
|
||||
|
||||
showEditEncPWForm: () ->
|
||||
$('#editEncPWDialog input').val('')
|
||||
$('#editEncPWDialog .hide').removeClass('hide')
|
||||
$('#editEncPWDialog').modal({})
|
||||
|
||||
$('#editEncPWDialog .btn-primary').unbind('click').click =>
|
||||
$('#editEncPWDialog .has-error').removeClass('has-error')
|
||||
confirmation = confirm('Do you really want to update your encryption password?')
|
||||
|
||||
if confirmation isnt true
|
||||
return
|
||||
|
||||
if $('#editEncPW_current_password').val() isnt @password
|
||||
$('#editEncPW_current_password').parent().addClass('has-error')
|
||||
return
|
||||
|
||||
new_password = $('#editEncPW_password').val()
|
||||
|
||||
if new_password is undefined or new_password is ''
|
||||
$('#editEncPW_password').parent().addClass('has-error')
|
||||
return
|
||||
|
||||
if new_password isnt $('#editEncPW_repeat_password').val()
|
||||
$('#editEncPW_password, #editEncPW_repeat_password').parent().addClass('has-error')
|
||||
return
|
||||
|
||||
@password = new_password
|
||||
@updateData =>
|
||||
$('#formEncPWClose').click()
|
||||
alert 'Your encryption password has been changed. Keep this in mind for later.'
|
||||
return
|
||||
|
||||
|
||||
window.CloudKeys = new CloudKeys()
|
||||
$('#importLink').click =>
|
||||
$('#importContainer').toggle(500)
|
||||
|
|
|
@ -27,14 +27,6 @@ func httpHelper(f httpHelperFunc) http.HandlerFunc {
|
|||
}
|
||||
|
||||
if template != nil {
|
||||
// Postponed until https://github.com/flosch/pongo2/issues/68
|
||||
//
|
||||
// tplsrc, err := Asset("templates/" + *template)
|
||||
// if err != nil {
|
||||
// fmt.Printf("ERR: Could not find template '%s'\n", *template)
|
||||
// http.Error(res, "An error ocurred.", http.StatusInternalServerError)
|
||||
// return
|
||||
// }
|
||||
ts := pongo2.NewSet("frontend")
|
||||
ts.SetBaseDirectory("templates")
|
||||
tpl, err := ts.FromFile(*template)
|
||||
|
|
|
@ -2,7 +2,7 @@ body {
|
|||
padding-top: 70px;
|
||||
}
|
||||
input {
|
||||
outline: 0;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.navbar a {
|
||||
|
@ -66,17 +66,17 @@ input {
|
|||
margin: 15px 0;
|
||||
|
||||
span {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ul#items {
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
li.active {
|
||||
background-color: #e5e3e9;
|
||||
}
|
||||
|
||||
|
||||
li {
|
||||
cursor: pointer;
|
||||
padding: 5px 20px;
|
||||
|
@ -91,19 +91,19 @@ input {
|
|||
display: none;
|
||||
list-style: none;
|
||||
padding-left: 5px;
|
||||
|
||||
|
||||
li.last {
|
||||
display: none;
|
||||
@media (min-width:768px) {
|
||||
border-bottom: 0;
|
||||
border-bottom: 0;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
li {
|
||||
border-bottom: 1px dotted gray;
|
||||
|
||||
|
||||
br { clear: both; }
|
||||
|
||||
|
||||
label {
|
||||
display: block;
|
||||
float: left;
|
||||
|
@ -120,7 +120,7 @@ input {
|
|||
padding-left: 0;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
|
||||
input.password {
|
||||
width: 200px;
|
||||
}
|
||||
|
|
2
main.go
2
main.go
|
@ -1,6 +1,6 @@
|
|||
package main // import "github.com/Luzifer/cloudkeys-go"
|
||||
|
||||
//go:generate go-bindata assets templates
|
||||
//go:generate go-bindata assets
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
<li><a id="importLink">Import</a></li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Settings <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a id="editEncPWLink">Change Encryption Password</a></li>
|
||||
<!-- TODO: <li><a id="editAccPWLink">Change Account Password</a></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Switch Account <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
@ -132,6 +139,38 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="editEncPWDialog" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Change Encryption Password</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="editEncPW_current_password">Current Password</label>
|
||||
<input type="password" class="form-control" id="editEncPW_current_password" placeholder="Enter Current Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="editEncPW_password">Password</label>
|
||||
<input type="password" class="form-control" id="editEncPW_password" placeholder="Enter Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="editEncPW_repeat_password">Repeat Password</label>
|
||||
<input type="password" class="form-control" id="editEncPW_repeat_password" placeholder="Repeat Password">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="formEncPWClose" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha1.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
|
|
Loading…
Reference in a new issue