Browse Source

added password change

master
arnaucode 7 years ago
parent
commit
1e26b86597
7 changed files with 78 additions and 2 deletions
  1. +4
    -1
      README.md
  2. +1
    -0
      www/index.html
  3. +10
    -0
      www/js/app.js
  4. +33
    -0
      www/js/password.js
  5. +4
    -0
      www/js/translations.js
  6. +21
    -0
      www/templates/password.html
  7. +5
    -1
      www/templates/settings.html

+ 4
- 1
README.md

@ -1,5 +1,8 @@
# carsincommonApp
server code: https://github.com/arnaucode/carsincommonServer
- server code: https://github.com/arnaucode/carsincommonServer
- frontend app code: https://github.com/arnaucode/carsincommonApp
- images server: https://github.com/arnaucode/goImgServer
- admin web: https://github.com/arnaucode/carsincommonAdminWeb
![carsincommon](https://raw.githubusercontent.com/arnaucode/carsincommonApp/master/carsincommon.png "carsincommon")

+ 1
- 0
www/index.html

@ -53,6 +53,7 @@
<script src="js/editUser.js"></script>
<script src="js/notifications.js"></script>
<script src="js/settings.js"></script>
<script src="js/password.js"></script>
<script src="js/help.js"></script>
</head>

+ 10
- 0
www/js/app.js

@ -33,6 +33,7 @@ angular.module('starter', [
'app.editUser',
'app.notifications',
'app.settings',
'app.password',
'app.help'
])
@ -218,6 +219,15 @@ angular.module('starter', [
}
}
})
.state('app.password', {
url: '/password',
views: {
'menuContent': {
templateUrl: 'templates/password.html',
controller: 'PasswordCtrl'
}
}
})
.state('app.help', {
url: '/help',
views: {

+ 33
- 0
www/js/password.js

@ -0,0 +1,33 @@
angular.module('app.password', ['pascalprecht.translate'])
.controller('PasswordCtrl', function($scope, $stateParams, $translate,
$http, $ionicLoading) {
$scope.newPass = {};
$scope.changePassword = function() {
console.log($scope.newPass);
$http({
url: urlapi + 'changePassword',
method: "PUT",
data: $scope.newPass
})
.then(function(data) {
console.log(data);
$ionicLoading.show({
template: 'Password updated',
noBackdrop: true,
duration: 2000
});
window.location = "#app/settings";
},
function(data) { // optional
// failed
console.log(data);
$ionicLoading.show({
template: 'Error updating password',
noBackdrop: true,
duration: 2000
});
});
};
});

+ 4
- 0
www/js/translations.js

@ -15,6 +15,10 @@ var translations = {
"Help": "Help",
"Username": "Username",
"Password": "Password",
"Old_Password": "Old Password",
"New_Password": "New Password",
"Repeat_New_Password": "Repeat New Password",
"Change_password": "Change password",
"Email": "Email",
"Phone": "Phone",
"Telegram": "Telegram",

+ 21
- 0
www/templates/password.html

@ -0,0 +1,21 @@
<ion-view view-title="{{'Change_password' | translate}}">
<ion-content>
<div class="list">
<label class="item item-input">
<span class="input-label">{{'Old_Password' | translate}}</span>
<input ng-model="newPassword.old" type="password" placeholder="{{'Old_Password' | translate}}" style="-webkit-text-security: disc;">
</label>
<label class="item item-input">
<span class="input-label">{{'New_Password' | translate}}</span>
<input ng-model="newPassword.new1" type="password" placeholder="{{'New_Password' | translate}}" style="-webkit-text-security: disc;">
</label>
<label class="item item-input">
<span class="input-label">{{'New_Password' | translate}}</span>
<input ng-model="newPassword.new2" type="password" placeholder="{{'Repeat_New_Password' | translate}}" style="-webkit-text-security: disc;">
</label>
</div>
<div ng-click="changePassword()" class="button button-block c_deepPurple200">
{{'Change_password' | translate}}
</div>
</ion-content>
</ion-view>

+ 5
- 1
www/templates/settings.html

@ -1,5 +1,5 @@
<ion-view view-title="{{'Settings' | translate}}">
<ion-content class="has-footer">
<ion-content>
<label class="item item-input item-select">
<div class="input-label">
{{'Actual_language' | translate}}
@ -12,5 +12,9 @@
<p>
{{'version' | translate}}: CarsInCommon-v0.1
</p>
Security:
<a ng-href="#/app/password" class="button button-small c_deepPurple200">
{{'Change_password' | translate}}
</a>
</ion-content>
</ion-view>

Loading…
Cancel
Save