mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
Password dialog
This commit is contained in:
parent
897b49e48c
commit
245050db33
3 changed files with 58 additions and 27 deletions
|
|
@ -10,5 +10,36 @@
|
|||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<modal title="modalTitle" ng-show="showModal" on-accept="onAcceptModal()" on-dismiss="onDismissModal()" dismiss-label="Cancel" accept-label="Change Password">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Current Password</label>
|
||||
<div class="col-sm-8">
|
||||
<input ng-model="modal.old_password" type="password" class="form-control" id="inputEmail3" placeholder="Current Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">New Password</label>
|
||||
<div class="col-sm-8">
|
||||
<input ng-model="modal.password" type="password" class="form-control" id="inputPassword3" placeholder="New Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Reenter Password</label>
|
||||
<div class="col-sm-8">
|
||||
<input ng-model="modal.password2" type="password" class="form-control" id="inputPassword3" placeholder="Reenter Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Password Strength</label>
|
||||
<div class="col-sm-4">
|
||||
<div ng-show="passwordStrength == 0"><label>Weak</label><br/><div class="col-sm-1" style="height: 4px; background-color: #e00;" /></div>
|
||||
<div ng-show="passwordStrength == 1"><label>Not enough</label><br/><div class="col-sm-5" style="height: 4px; background-color: #FF7E00;" /></div>
|
||||
<div ng-show="passwordStrength == 2"><label>Medium</label><br/><div class="col-sm-8" style="height: 4px; background-color: #FF9000;" /></div>
|
||||
<div ng-show="passwordStrength == 3"><label>Strong</label><br/><div class="col-sm-12" style="height: 4px; background-color: #2D951E;" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</modal>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,33 @@
|
|||
$juci.module("router")
|
||||
.controller("SettingsPasswordCtrl", function($scope){
|
||||
$scope.showPassword = 0;
|
||||
$scope.showModal = 0;
|
||||
$scope.modal = {
|
||||
old_password: "",
|
||||
password: "test",
|
||||
password2: ""
|
||||
};
|
||||
$scope.passwordStrength = 1;
|
||||
|
||||
|
||||
function measureStrength(p) {
|
||||
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
|
||||
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
|
||||
var enoughRegex = new RegExp("(?=.{4,}).*", "g");
|
||||
|
||||
if(strongRegex.test(p)) return 3;
|
||||
if(mediumRegex.test(p)) return 2;
|
||||
if(enoughRegex.test(p)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$scope.$watch("modal", function(){
|
||||
$scope.passwordStrength = measureStrength($scope.modal.password);
|
||||
}, true);
|
||||
$scope.onChangePasswordClick = function(){
|
||||
$rpc.luci2.system.password_set({user: "martin", password: "asdf"}).done(function(data){
|
||||
console.log(JSON.stringify(data));
|
||||
});
|
||||
$scope.showModal = 1;
|
||||
/*$rpc.luci2.system.password_set({user: "martin", password: "asdf"}).done(function(data){
|
||||
$scope.showModal = 1;
|
||||
}); */
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,30 +31,6 @@ div.logo {
|
|||
width: 32px;
|
||||
}
|
||||
|
||||
@media all and (min-width: 0px) and (max-width: 768px) {
|
||||
.only-desktop {
|
||||
display: none;
|
||||
}
|
||||
.only-tablet {
|
||||
display: none;
|
||||
}
|
||||
.only-mobile {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 768px) {
|
||||
.only-desktop {
|
||||
display: block;
|
||||
}
|
||||
.only-tablet {
|
||||
display: none;
|
||||
}
|
||||
.only-mobile {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#rhombus-wrap {
|
||||
float: left;
|
||||
margin-left: -80px;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue