Now chpassword is a independent button
This commit is contained in:
parent
2f65abfba6
commit
390077535a
|
@ -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):
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
||||
|
@ -170,6 +170,36 @@
|
|||
</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