From 1e26b86597284cff54fd59da8937e54b25e7cf52 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Tue, 25 Jul 2017 22:52:56 +0200 Subject: [PATCH] added password change --- README.md | 5 ++++- www/index.html | 1 + www/js/app.js | 10 ++++++++++ www/js/password.js | 33 +++++++++++++++++++++++++++++++++ www/js/translations.js | 4 ++++ www/templates/password.html | 21 +++++++++++++++++++++ www/templates/settings.html | 6 +++++- 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 www/js/password.js create mode 100644 www/templates/password.html diff --git a/README.md b/README.md index 7195a28..5149261 100644 --- a/README.md +++ b/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") diff --git a/www/index.html b/www/index.html index b020dda..435a1e0 100644 --- a/www/index.html +++ b/www/index.html @@ -53,6 +53,7 @@ + diff --git a/www/js/app.js b/www/js/app.js index 21aba3e..3209e6e 100644 --- a/www/js/app.js +++ b/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: { diff --git a/www/js/password.js b/www/js/password.js new file mode 100644 index 0000000..d955ed1 --- /dev/null +++ b/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 + }); + + }); + }; + }); diff --git a/www/js/translations.js b/www/js/translations.js index 289930a..6a022c3 100644 --- a/www/js/translations.js +++ b/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", diff --git a/www/templates/password.html b/www/templates/password.html new file mode 100644 index 0000000..af2191a --- /dev/null +++ b/www/templates/password.html @@ -0,0 +1,21 @@ + + +
+ + + +
+
+ {{'Change_password' | translate}} +
+
+
diff --git a/www/templates/settings.html b/www/templates/settings.html index f427362..255e403 100644 --- a/www/templates/settings.html +++ b/www/templates/settings.html @@ -1,5 +1,5 @@ - +