Now chpassword is a independent button
This commit is contained in:
parent
2f65abfba6
commit
390077535a
|
@ -503,7 +503,7 @@ class userManager:
|
|||
settingfile.close()
|
||||
|
||||
return {'success': 'true', 'quota' : groupinfo, 'usage' : usageinfo, 'default': defaultsetting }
|
||||
|
||||
|
||||
@token_required
|
||||
def usageInc(self, *args, **kwargs):
|
||||
'''
|
||||
|
@ -540,7 +540,7 @@ class userManager:
|
|||
usage.disk = str(disk)
|
||||
db.session.commit()
|
||||
return [True, "distribute the resource"]
|
||||
|
||||
|
||||
@token_required
|
||||
def usageRecover(self, *args, **kwargs):
|
||||
'''
|
||||
|
@ -626,7 +626,7 @@ class userManager:
|
|||
usage.disk = str(nowdisk)
|
||||
db.session.commit()
|
||||
return True
|
||||
|
||||
|
||||
def initUsage(*args, **kwargs):
|
||||
"""
|
||||
init the usage info when start docklet with init mode
|
||||
|
@ -776,6 +776,14 @@ class userManager:
|
|||
db.session.commit()
|
||||
return {"success": "true"}
|
||||
|
||||
if ( kwargs['newValue'].get('password', '') != ''):
|
||||
user_modify = User.query.filter_by(username = kwargs['newValue'].get('username', None)).first()
|
||||
new_password = kwargs['newValue'].get('password','')
|
||||
new_password = hashlib.sha512(new_password.encode('utf-8')).hexdigest()
|
||||
user_modify.password = new_password
|
||||
db.session.commit()
|
||||
return {"success": "true"}
|
||||
|
||||
user_modify = User.query.filter_by(username = kwargs['newValue'].get('username', None)).first()
|
||||
if (user_modify == None):
|
||||
|
||||
|
@ -928,7 +936,7 @@ class userManager:
|
|||
groupfile.write(json.dumps(groups))
|
||||
groupfile.close()
|
||||
return {"success":'true'}
|
||||
|
||||
|
||||
@administration_required
|
||||
def lxcsettingList(*args, **kwargs):
|
||||
lxcsettingfile = open(fspath+"/global/sys/lxc.default", 'r')
|
||||
|
|
|
@ -161,15 +161,45 @@
|
|||
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" onClick="javascript:sendModifyUser();">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal inmodal" id="ChpasswordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated fadeIn">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
<i class="fa fa-laptop modal-icon"></i>
|
||||
<h4 class="modal-title">Changing Password</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="/user/change/" method="POST" id="chpasswordForm">
|
||||
<div class="form-group">
|
||||
<label>User Name</label>
|
||||
<input type = "text" placeholder="Enter Username" class="form-control" name="username" id="mpUsername" readonly="readonly">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input type="password" placeholder="Enter Password" class="form-control" name="password" id="mpPassword">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" onClick="javascript:sendChpassword();">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -199,6 +229,10 @@
|
|||
{
|
||||
str=str + '<a class="btn btn-danger btn-xs" onClick="javascript:setActivateUser(' + row[0] + ');">' + 'Activate' + '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
str=str + '<a class="btn btn-primary btn-xs" data-toggle="modal" data-target="#ChpasswordModal" onClick="javascript:setFormChpassword(\'' + row[1] + '\');">' + 'Chpassword' + '</a>';
|
||||
}
|
||||
return str;
|
||||
},
|
||||
"targets": 8
|
||||
|
@ -232,6 +266,9 @@
|
|||
function sendModifyUser(){
|
||||
document.getElementById("modifyUserForm").submit();
|
||||
}
|
||||
function sendChpassword(){
|
||||
document.getElementById("chpasswordForm").submit();
|
||||
}
|
||||
function sendModifyGroup(){
|
||||
document.getElementById("modifyGroupForm").submit();
|
||||
}
|
||||
|
@ -254,6 +291,9 @@
|
|||
$("#mDescription").val(result.description);
|
||||
});
|
||||
}
|
||||
function setFormChpassword(arg){
|
||||
$("#mpUsername").val(arg);
|
||||
}
|
||||
function setActivateUser(arg){
|
||||
$.post("/user/change/",
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue