added password change

This commit is contained in:
arnaucode
2017-07-25 22:52:56 +02:00
parent 34e8e21ce3
commit 1e26b86597
7 changed files with 78 additions and 2 deletions

View File

@@ -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
www/js/password.js Normal file
View File

@@ -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
});
});
};
});

View File

@@ -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",