From 5655bd59bd6bb56b759e69e52da1fdc6bd3fe611 Mon Sep 17 00:00:00 2001 From: Michael Looby Date: Tue, 26 Aug 2014 00:27:42 -0400 Subject: [PATCH 1/5] Fixed bug #3007 where using wrong "old password" when changing password results in "Password changed succesfully" message even though password change fails. --- public/js/app.js | 6 +++++- public/js/controllers/rootCtrl.js | 8 ++++---- public/js/controllers/settingsCtrl.js | 11 ++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 3f2aae2a08..810dbc8367 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -234,8 +234,12 @@ window.habitrpg = angular.module('habitrpg', window.location.href = '/logout'; // 400 range? - } else if (response < 500) { + } else if (response.status < 500) { $rootScope.$broadcast('responseText', response.data.err || response.data); + // Need to reject the prompse so the error is handled correctly + if (response.status === 401) { + return $q.reject(response); + } // Error } else { diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index b990050ef5..1582aecaae 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -124,8 +124,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } @@ -144,8 +144,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } diff --git a/public/js/controllers/settingsCtrl.js b/public/js/controllers/settingsCtrl.js index 9b474d8bab..a6c401d179 100644 --- a/public/js/controllers/settingsCtrl.js +++ b/public/js/controllers/settingsCtrl.js @@ -23,7 +23,7 @@ habitrpg.controller('SettingsCtrl', window.location.reload(); }); } - } + } $scope.toggleStickyHeader = function(){ $rootScope.$on('userSynced', function(){ @@ -85,7 +85,7 @@ habitrpg.controller('SettingsCtrl', $scope.changeUser = {}; }) .error(function(data){ - alert(data); + alert(data.err); }); } @@ -94,12 +94,13 @@ habitrpg.controller('SettingsCtrl', return alert(window.env.t('fillAll')); } $http.post(API_URL + '/api/v2/user/change-password', changePass) - .success(function(){ + .success(function(data, status, headers, config){ + if (data.err) return alert(data.err); alert(window.env.t('passSuccess')); $scope.changePass = {}; }) - .error(function(data){ - alert(data); + .error(function(data, status, headers, config){ + alert(data.err); }); } From 77a06655b62a791a7a28a2130d637e70ae97cb2b Mon Sep 17 00:00:00 2001 From: Michael Looby Date: Tue, 26 Aug 2014 00:27:42 -0400 Subject: [PATCH 2/5] Fixed bug #3007 where using wrong "old password" when changing password results in "Password changed succesfully" message even though password change fails. --- public/js/app.js | 6 +++++- public/js/controllers/rootCtrl.js | 8 ++++---- public/js/controllers/settingsCtrl.js | 11 ++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 3f2aae2a08..810dbc8367 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -234,8 +234,12 @@ window.habitrpg = angular.module('habitrpg', window.location.href = '/logout'; // 400 range? - } else if (response < 500) { + } else if (response.status < 500) { $rootScope.$broadcast('responseText', response.data.err || response.data); + // Need to reject the prompse so the error is handled correctly + if (response.status === 401) { + return $q.reject(response); + } // Error } else { diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index b990050ef5..1582aecaae 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -124,8 +124,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } @@ -144,8 +144,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } diff --git a/public/js/controllers/settingsCtrl.js b/public/js/controllers/settingsCtrl.js index 9b474d8bab..a6c401d179 100644 --- a/public/js/controllers/settingsCtrl.js +++ b/public/js/controllers/settingsCtrl.js @@ -23,7 +23,7 @@ habitrpg.controller('SettingsCtrl', window.location.reload(); }); } - } + } $scope.toggleStickyHeader = function(){ $rootScope.$on('userSynced', function(){ @@ -85,7 +85,7 @@ habitrpg.controller('SettingsCtrl', $scope.changeUser = {}; }) .error(function(data){ - alert(data); + alert(data.err); }); } @@ -94,12 +94,13 @@ habitrpg.controller('SettingsCtrl', return alert(window.env.t('fillAll')); } $http.post(API_URL + '/api/v2/user/change-password', changePass) - .success(function(){ + .success(function(data, status, headers, config){ + if (data.err) return alert(data.err); alert(window.env.t('passSuccess')); $scope.changePass = {}; }) - .error(function(data){ - alert(data); + .error(function(data, status, headers, config){ + alert(data.err); }); } From 5f8a76e579d8203889bd3da3e1e9261cc652532d Mon Sep 17 00:00:00 2001 From: Michael Looby Date: Tue, 26 Aug 2014 14:59:54 -0400 Subject: [PATCH 3/5] Fix for issue #3477, 'No "Contact Us" at Bottom of the page. Added the new link and used the existing env.t('contactUs') string so all the translations are correct. Also added the link to layout.jade because that was stubbed out there in comments. Both links go to a new page with other links as described in the issue. --- views/shared/footer.jade | 2 ++ views/static/contact.jade | 35 +++++++++++++++++++++++++++++------ views/static/layout.jade | 6 +++--- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/views/shared/footer.jade b/views/shared/footer.jade index 106e29547f..69e590cbec 100644 --- a/views/shared/footer.jade +++ b/views/shared/footer.jade @@ -33,6 +33,8 @@ footer.footer(ng-controller='FooterCtrl') a(href='/static/privacy')=env.t('companyPrivacy') li a(href='/static/terms')=env.t('companyTerms') + li + a(href='/static/contact')=env.t('contactUs') .col-sm-3 h4=env.t('footerCommunity') ul.list-unstyled diff --git a/views/static/contact.jade b/views/static/contact.jade index 129734d3de..8672c29eba 100644 --- a/views/static/contact.jade +++ b/views/static/contact.jade @@ -1,12 +1,35 @@ extends ./layout +//-Trick needed to pass 'env' to ./layout block vars - var layoutEnv = env - var menuItem = 'contact' + block title - title=env.t('contact') + title=env.t('contactUs') + block content - // Probably just add linkks to the respective contact locations? - // Bugs? Github - // Feature requests? Trello - // Enterprise? Click the "pricing" tab - /// etc \ No newline at end of file + .row + .col-md-12 + .page-header + h1=env.t('contactUs') + p + | Report Account Problems: + a(href='mailto:admin@habitrpg.com') admin@gmail.com + br + | Report a Bug: + a(target='_blank', href='https://github.com/HabitRPG/habitrpg/issues?q=is%3Aopen') Github + br + | Report Community Issues: + a(href='mailto:leslie@habitrpg.com') leslie@habitrpg.com + br + | General Questions about the Site: + a(target='_blank', href='http://habitrpg.wikia.com/wiki/The_Keep:The_Newbies_Guild') Newbies Guild + br + | Business Inquiries: + a(href='mailto:vicky@habitrpg.com') vicky@habitrpg.com + br + | Merchandise Inquiries: + a(href='mailto:store@habitrpg.com') store@habitrpg.com + br + | Marketing/Social Media Inquiries: + a(href='mailto:leslie@habitrpg.com') leslie@habitrpg.com diff --git a/views/static/layout.jade b/views/static/layout.jade index db836cc8b0..11fe1ffa87 100644 --- a/views/static/layout.jade +++ b/views/static/layout.jade @@ -38,12 +38,12 @@ html(ng-app='habitrpgStatic') a(href='http://blog.habitrpg.com/')=env.t('companyBlog') li(class='#{menuItem=="plans" ? "active" : ""}') a(href='/static/plans')=env.t('groupPlans') - //li(class='#{menuItem=="contact" ? "active" : ""}') - a(href='/static/contact')=env.t('contact') + li(class='#{menuItem=="contact" ? "active" : ""}') + a(href='/static/contact')=env.t('contactUs') button#header-play-button.btn.btn-primary.navbar-btn.navbar-right(ng-click='playButtonClick()')=env.t('playButton') .container block content - include ../shared/footer \ No newline at end of file + include ../shared/footer From e19aca003659f5178402fc27578f21ca7661a467 Mon Sep 17 00:00:00 2001 From: Michael Looby Date: Tue, 26 Aug 2014 00:27:42 -0400 Subject: [PATCH 4/5] Fixed bug #3007 where using wrong "old password" when changing password results in "Password changed succesfully" message even though password change fails. --- public/js/app.js | 6 +++++- public/js/controllers/rootCtrl.js | 8 ++++---- public/js/controllers/settingsCtrl.js | 11 ++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 3f2aae2a08..810dbc8367 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -234,8 +234,12 @@ window.habitrpg = angular.module('habitrpg', window.location.href = '/logout'; // 400 range? - } else if (response < 500) { + } else if (response.status < 500) { $rootScope.$broadcast('responseText', response.data.err || response.data); + // Need to reject the prompse so the error is handled correctly + if (response.status === 401) { + return $q.reject(response); + } // Error } else { diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index b990050ef5..1582aecaae 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -124,8 +124,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } @@ -144,8 +144,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.$apply(function(){ $http.post(url, data).success(function() { window.location.reload(true); - }).error(function(err) { - alert(err); + }).error(function(data) { + alert(data.err); }); }) } diff --git a/public/js/controllers/settingsCtrl.js b/public/js/controllers/settingsCtrl.js index 9b474d8bab..a6c401d179 100644 --- a/public/js/controllers/settingsCtrl.js +++ b/public/js/controllers/settingsCtrl.js @@ -23,7 +23,7 @@ habitrpg.controller('SettingsCtrl', window.location.reload(); }); } - } + } $scope.toggleStickyHeader = function(){ $rootScope.$on('userSynced', function(){ @@ -85,7 +85,7 @@ habitrpg.controller('SettingsCtrl', $scope.changeUser = {}; }) .error(function(data){ - alert(data); + alert(data.err); }); } @@ -94,12 +94,13 @@ habitrpg.controller('SettingsCtrl', return alert(window.env.t('fillAll')); } $http.post(API_URL + '/api/v2/user/change-password', changePass) - .success(function(){ + .success(function(data, status, headers, config){ + if (data.err) return alert(data.err); alert(window.env.t('passSuccess')); $scope.changePass = {}; }) - .error(function(data){ - alert(data); + .error(function(data, status, headers, config){ + alert(data.err); }); } From 1fd27b030263807212eae4f79f8316e09a21a0dc Mon Sep 17 00:00:00 2001 From: Michael Looby Date: Tue, 26 Aug 2014 14:59:54 -0400 Subject: [PATCH 5/5] Fix for issue #3477, 'No "Contact Us" at Bottom of the page. Added the new link and used the existing env.t('contactUs') string so all the translations are correct. Also added the link to layout.jade because that was stubbed out there in comments. Both links go to a new page with other links as described in the issue. --- views/shared/footer.jade | 2 ++ views/static/contact.jade | 35 +++++++++++++++++++++++++++++------ views/static/layout.jade | 6 +++--- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/views/shared/footer.jade b/views/shared/footer.jade index 106e29547f..69e590cbec 100644 --- a/views/shared/footer.jade +++ b/views/shared/footer.jade @@ -33,6 +33,8 @@ footer.footer(ng-controller='FooterCtrl') a(href='/static/privacy')=env.t('companyPrivacy') li a(href='/static/terms')=env.t('companyTerms') + li + a(href='/static/contact')=env.t('contactUs') .col-sm-3 h4=env.t('footerCommunity') ul.list-unstyled diff --git a/views/static/contact.jade b/views/static/contact.jade index 129734d3de..8672c29eba 100644 --- a/views/static/contact.jade +++ b/views/static/contact.jade @@ -1,12 +1,35 @@ extends ./layout +//-Trick needed to pass 'env' to ./layout block vars - var layoutEnv = env - var menuItem = 'contact' + block title - title=env.t('contact') + title=env.t('contactUs') + block content - // Probably just add linkks to the respective contact locations? - // Bugs? Github - // Feature requests? Trello - // Enterprise? Click the "pricing" tab - /// etc \ No newline at end of file + .row + .col-md-12 + .page-header + h1=env.t('contactUs') + p + | Report Account Problems: + a(href='mailto:admin@habitrpg.com') admin@gmail.com + br + | Report a Bug: + a(target='_blank', href='https://github.com/HabitRPG/habitrpg/issues?q=is%3Aopen') Github + br + | Report Community Issues: + a(href='mailto:leslie@habitrpg.com') leslie@habitrpg.com + br + | General Questions about the Site: + a(target='_blank', href='http://habitrpg.wikia.com/wiki/The_Keep:The_Newbies_Guild') Newbies Guild + br + | Business Inquiries: + a(href='mailto:vicky@habitrpg.com') vicky@habitrpg.com + br + | Merchandise Inquiries: + a(href='mailto:store@habitrpg.com') store@habitrpg.com + br + | Marketing/Social Media Inquiries: + a(href='mailto:leslie@habitrpg.com') leslie@habitrpg.com diff --git a/views/static/layout.jade b/views/static/layout.jade index db836cc8b0..11fe1ffa87 100644 --- a/views/static/layout.jade +++ b/views/static/layout.jade @@ -38,12 +38,12 @@ html(ng-app='habitrpgStatic') a(href='http://blog.habitrpg.com/')=env.t('companyBlog') li(class='#{menuItem=="plans" ? "active" : ""}') a(href='/static/plans')=env.t('groupPlans') - //li(class='#{menuItem=="contact" ? "active" : ""}') - a(href='/static/contact')=env.t('contact') + li(class='#{menuItem=="contact" ? "active" : ""}') + a(href='/static/contact')=env.t('contactUs') button#header-play-button.btn.btn-primary.navbar-btn.navbar-right(ng-click='playButtonClick()')=env.t('playButton') .container block content - include ../shared/footer \ No newline at end of file + include ../shared/footer