arnaucube
arnaucube/commonroutesAppPublic Self-hosted repository
added password change
arnaucode idoctnef@openmailbox.org
Tue, 25 Jul 2017 22:52:56 +0200
commit

1e26b86597284cff54fd59da8937e54b25e7cf52

parent

34e8e21ce378975dc3e9709515df75c993f85c0e

M README.md → 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")
M www/index.html → www/index.html

@@ -53,6 +53,7 @@ <script src="js/userLikes.js"></script>

<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>
M www/js/app.js → www/js/app.js

@@ -33,6 +33,7 @@ 'app.userLikes',

'app.editUser', 'app.notifications', 'app.settings', + 'app.password', 'app.help' ])

@@ -215,6 +216,15 @@ views: {

'menuContent': { templateUrl: 'templates/settings.html', controller: 'SettingsCtrl' + } + } + }) + .state('app.password', { + url: '/password', + views: { + 'menuContent': { + templateUrl: 'templates/password.html', + controller: 'PasswordCtrl' } } })
A 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 + }); + + }); + }; + });
M www/js/translations.js → www/js/translations.js

@@ -15,6 +15,10 @@ "Settings": "Settings",

"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",
A 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>
M www/templates/settings.html → 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 @@ </label>

<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>