Commit 1a503d3360d4394c5661e0e9d8570d7a137893f3

Authored by Kevin Mach
1 parent 4b54a81190
Exists in master

fixed reset PW form but still have to logout and log back in

Showing 2 changed files with 26 additions and 9 deletions Inline Diff

scripts/SettingsController.js View file @ 1a503d3
angular.module('flashy.SettingsController', ['ui.router']). 1 1 angular.module('flashy.SettingsController', ['ui.router']).
2 2
controller('SettingsController', function($rootScope, $resource, $scope, $state, $http, UserService) { 3 3 controller('SettingsController', function($rootScope, $resource, $scope, $state, $http, UserService) {
$scope.error = false; 4 4 $scope.error = false;
$scope.success = false; 5 5 $scope.success = false;
$scope.mismatch = false; 6 6 $scope.mismatch = false;
$scope.unacceptable = false; 7 7 $scope.unacceptable = false;
8 8
9
$scope.changePassword = function(oldPassword, newPassword, confirmedNewPassword) { 9 10 $scope.changePassword = function(oldPassword, newPassword, confirmedNewPassword) {
console.log('in change password'); 10 11 console.log('in change password');
11 12
if (newPassword != $scope.confirmedNewPassword) { 12 13
14
15 if ($scope.ChangePasswordForm.newpw.$error.minlength == true) {
16
17 $scope.unacceptable = true;
18 console.log('unacceptable password');
19 return;
20 }
21
22 if (newPassword != confirmedNewPassword) {
$scope.mismatch = true; 13 23 $scope.mismatch = true;
console.log('mismatch'); 14 24 console.log('mismatch');
return; 15 25 return;
} 16 26 } else {
27
28 $scope.mismatch = false;
29
30 }
17 31
32
33
$http.patch('/api/me/', { 18 34 $http.patch('/api/me/', {
'old_password': oldPassword, 19 35 'old_password': oldPassword,
'new_password': newPassword 20 36 'new_password': newPassword
}) 21 37 })
.success(function(data) { 22 38 .success(function(data) {
console.log('password successfully changes'); 23 39 console.log('password successfully changes');
Materialize.toast('Your password was successfully changed'); 24 40 Materialize.toast('Your password was successfully changed', 3000);
$state.go('login'); 25 41 $state.go('login');
42
}) 26 43 })
.error(function(data) { 27 44 .error(function(data) {
console.log('problem changing the password'); 28 45 console.log('problem changing the password');
Materialize.toast('Your old password is not correct'); 29 46 Materialize.toast('Your old password is not correct', 3000);
$state.go('login'); 30
}); 31 47 });
}; 32 48 };
33 49
$scope.dropClass = function(section) { 34 50 $scope.dropClass = function(section) {
$http.post('/api/sections/' + section.id + '/drop/'). 35 51 $http.post('/api/sections/' + section.id + '/drop/').
success(function(data) { 36 52 success(function(data) {
UserService.dropClass(section.id); 37 53 UserService.dropClass(section.id);
console.log(section.short_name + ' dropped'); 38 54 console.log(section.short_name + ' dropped');
Materialize.toast('Dropped', 3000); 39 55 Materialize.toast('Dropped', 3000);
}); 40 56 });
}; 41 57 };
42 58
43 59
console.log('checking to see if chrome'); 44 60 console.log('checking to see if chrome');
45 61
if (typeof(chrome) === 'undefined') { 46 62 if (typeof(chrome) === 'undefined') {
//pushSwitch.disabled = true; 47 63 //pushSwitch.disabled = true;
return; 48 64 return;
} 49 65 }
50 66
console.log('chrome'); 51 67 console.log('chrome');
52 68
console.log('executing things outside of module'); 53 69 console.log('executing things outside of module');
var PUSH_SERVER_URL = '/api/subscribe/'; 54 70 var PUSH_SERVER_URL = '/api/subscribe/';
var UNPUSH_SERVER_URL = '/api/unsubscribe/'; 55 71 var UNPUSH_SERVER_URL = '/api/unsubscribe/';
56 72
function onPushSubscription(pushSubscription) { 57 73 function onPushSubscription(pushSubscription) {
console.log('pushSubscription = ', pushSubscription.endpoint); 58 74 console.log('pushSubscription = ', pushSubscription.endpoint);
// Here we would normally send the endpoint 59 75 // Here we would normally send the endpoint
// and subscription ID to our server. 60 76 // and subscription ID to our server.
// In this demo we just use send these values to 61 77 // In this demo we just use send these values to
// our server via XHR which sends a push message. 62 78 // our server via XHR which sends a push message.
63 79
var endpoint = pushSubscription.endpoint; 64 80 var endpoint = pushSubscription.endpoint;
var subscriptionId = pushSubscription.subscriptionId; 65 81 var subscriptionId = pushSubscription.subscriptionId;
66 82
console.log('registration_id: ', subscriptionId); 67 83 console.log('registration_id: ', subscriptionId);
$http.post(PUSH_SERVER_URL, {'registration_id': subscriptionId}); 68 84 $http.post(PUSH_SERVER_URL, {'registration_id': subscriptionId});
} 69 85 }
70 86
function removeSubscription(pushSubscription) { 71 87 function removeSubscription(pushSubscription) {
console.log('removing subscription'); 72 88 console.log('removing subscription');
console.log('pushSubscription endpoint = ', pushSubscription.endpoint); 73 89 console.log('pushSubscription endpoint = ', pushSubscription.endpoint);
74 90
var subscriptionId = pushSubscription.subscriptionId; 75 91 var subscriptionId = pushSubscription.subscriptionId;
76 92
console.log('registration_id: ', subscriptionId); 77 93 console.log('registration_id: ', subscriptionId);
$http.post(UNPUSH_SERVER_URL, {'registration_id': subscriptionId}); 78 94 $http.post(UNPUSH_SERVER_URL, {'registration_id': subscriptionId});
} 79 95 }
80 96
function subscribeDevice() { 81 97 function subscribeDevice() {
// We need the service worker registration to access the push manager 82 98 // We need the service worker registration to access the push manager
navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { 83 99 navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
serviceWorkerRegistration.pushManager.subscribe() 84 100 serviceWorkerRegistration.pushManager.subscribe()
.then(onPushSubscription) 85 101 .then(onPushSubscription)
.catch(function(e) { 86 102 .catch(function(e) {
console.log('Error in subscribing'); 87 103 console.log('Error in subscribing');
// Check for a permission prompt issue 88 104 // Check for a permission prompt issue
if ('permissions' in navigator) { 89 105 if ('permissions' in navigator) {
navigator.permissions.query({name: 'push', userVisibleOnly: true}) 90 106 navigator.permissions.query({name: 'push', userVisibleOnly: true})
.then(function(permissionStatus) { 91 107 .then(function(permissionStatus) {
console.log('subscribe() Error: Push permission status = ', 92 108 console.log('subscribe() Error: Push permission status = ',
permissionStatus); 93 109 permissionStatus);
if (permissionStatus.status === 'denied') { 94 110 if (permissionStatus.status === 'denied') {
pushSwitch.checked = false; 95 111 pushSwitch.checked = false;
pushSwitch.disabled = true; 96 112 pushSwitch.disabled = true;
// The user blocked the permission prompt 97 113 // The user blocked the permission prompt
console.log('Ooops Notifications are Blocked', 98 114 console.log('Ooops Notifications are Blocked',
'Unfortunately you just permanently blocked notifications. ' + 99 115 'Unfortunately you just permanently blocked notifications. ' +
'Please unblock / allow them to switch on push ' + 100 116 'Please unblock / allow them to switch on push ' +
'notifications.'); 101 117 'notifications.');
} else { 102 118 } else {
pushSwitch.checked = false; 103 119 pushSwitch.checked = false;
console.log('Ooops Push Couldn\'t Register', 104 120 console.log('Ooops Push Couldn\'t Register',
'<p>When we tried to ' + 105 121 '<p>When we tried to ' +
'get the subscription ID for GCM, something went wrong,' + 106 122 'get the subscription ID for GCM, something went wrong,' +
' not sure why.</p>' + 107 123 ' not sure why.</p>' +
'<p>Have you defined "gcm_sender_id" and ' + 108 124 '<p>Have you defined "gcm_sender_id" and ' +
'"gcm_user_visible_only" in the manifest?</p>' + 109 125 '"gcm_user_visible_only" in the manifest?</p>' +
'<p>Error message: ' + 110 126 '<p>Error message: ' +
e.message + 111 127 e.message +
'</p>'); 112 128 '</p>');
} 113 129 }
}).catch(function(err) { 114 130 }).catch(function(err) {
pushSwitch.checked = false; 115 131 pushSwitch.checked = false;
console.log('Ooops Push Couldn\'t Register', 116 132 console.log('Ooops Push Couldn\'t Register',
'<p>When we tried to ' + 117 133 '<p>When we tried to ' +
'get the subscription ID for GCM, something went wrong, not ' + 118 134 'get the subscription ID for GCM, something went wrong, not ' +
'sure why.</p>' + 119 135 'sure why.</p>' +
'<p>Have you defined "gcm_sender_id" and ' + 120 136 '<p>Have you defined "gcm_sender_id" and ' +
'"gcm_user_visible_only" in the manifest?</p>' + 121 137 '"gcm_user_visible_only" in the manifest?</p>' +
'<p>Error message: ' + 122 138 '<p>Error message: ' +
err.message + 123 139 err.message +
'</p>'); 124 140 '</p>');
}); 125 141 });
} else { 126 142 } else {
// Use notification permission to do something 127 143 // Use notification permission to do something
if (Notification.permission === 'denied') { 128 144 if (Notification.permission === 'denied') {
pushSwitch.disabled = true; 129 145 pushSwitch.disabled = true;
pushSwitch.checked = false; 130 146 pushSwitch.checked = false;
console.log('Ooops Notifications are Blocked', 131 147 console.log('Ooops Notifications are Blocked',
'Unfortunately you just permanently blocked notifications. ' + 132 148 'Unfortunately you just permanently blocked notifications. ' +
'Please unblock / allow them to switch on push notifications.'); 133 149 'Please unblock / allow them to switch on push notifications.');
} else { 134 150 } else {
pushSwitch.checked = false; 135 151 pushSwitch.checked = false;
console.log('Ooops Push Couldn\'t Register', 136 152 console.log('Ooops Push Couldn\'t Register',
'<p>When we tried to ' + 137 153 '<p>When we tried to ' +
'get the subscription ID for GCM, something went wrong, not ' + 138 154 'get the subscription ID for GCM, something went wrong, not ' +
'sure why.</p>' + 139 155 'sure why.</p>' +
'<p>Have you defined "gcm_sender_id" and ' + 140 156 '<p>Have you defined "gcm_sender_id" and ' +
'"gcm_user_visible_only" in the manifest?</p>' + 141 157 '"gcm_user_visible_only" in the manifest?</p>' +
'<p>Error message: ' + 142 158 '<p>Error message: ' +
e.message + 143 159 e.message +
'</p>'); 144 160 '</p>');
} 145 161 }
} 146 162 }
}); 147 163 });
}); 148 164 });
} 149 165 }
150 166
function unsubscribeDevice() { 151 167 function unsubscribeDevice() {
navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { 152 168 navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
serviceWorkerRegistration.pushManager.getSubscription().then( 153 169 serviceWorkerRegistration.pushManager.getSubscription().then(
function(pushSubscription) { 154 170 function(pushSubscription) {
// Check we have everything we need to unsubscribe 155 171 // Check we have everything we need to unsubscribe
if (!pushSubscription) { 156 172 if (!pushSubscription) {
pushSwitch.checked = false; 157 173 pushSwitch.checked = false;
return; 158 174 return;
} 159 175 }
160 176
// TODO: Remove the device details from the server 161 177 // TODO: Remove the device details from the server
// i.e. the pushSubscription.subscriptionId and 162 178 // i.e. the pushSubscription.subscriptionId and
// pushSubscription.endpoint 163 179 // pushSubscription.endpoint
var subscriptionId = pushSubscription.subscriptionId; 164 180 var subscriptionId = pushSubscription.subscriptionId;
165 181
pushSubscription.unsubscribe().then(function(successful) { 166 182 pushSubscription.unsubscribe().then(function(successful) {
console.log('Unsubscribed from push: ', successful); 167 183 console.log('Unsubscribed from push: ', successful);
168 184
if (!successful) { 169 185 if (!successful) {
// The unsubscribe was unsuccessful, but we can 170 186 // The unsubscribe was unsuccessful, but we can
// remove the subscriptionId from our server 171 187 // remove the subscriptionId from our server
// and notifications will stop 172 188 // and notifications will stop
// This just may be in a bad state when the user returns 173 189 // This just may be in a bad state when the user returns
pushSwitch.checked = true; 174 190 pushSwitch.checked = true;
console.error('We were unable to unregister from push, but we removed' + 175 191 console.error('We were unable to unregister from push, but we removed' +
'registration id from the server'); 176 192 'registration id from the server');
} 177 193 }
removeSubscription(pushSubscription); 178 194 removeSubscription(pushSubscription);
179 195
}).catch(function(e) { 180 196 }).catch(function(e) {
console.log('Unsubscribtion error: ', e); 181 197 console.log('Unsubscribtion error: ', e);
}); 182 198 });
}.bind(this)).catch(function(e) { 183 199 }.bind(this)).catch(function(e) {
console.error('Error thrown while revoking push notifications. ' + 184 200 console.error('Error thrown while revoking push notifications. ' +
'Most likely because push was never registered', e); 185 201 'Most likely because push was never registered', e);
}); 186 202 });
}); 187 203 });
} 188 204 }
189 205
function permissionStatusChange(permissionStatus) { 190 206 function permissionStatusChange(permissionStatus) {
console.log('permissionStatusChange = ', permissionStatus); 191 207 console.log('permissionStatusChange = ', permissionStatus);
// If the notification permission is denied, it's a permanent block 192 208 // If the notification permission is denied, it's a permanent block
switch (permissionStatus.status) { 193 209 switch (permissionStatus.status) {
case 'denied': 194 210 case 'denied':
pushSwitch.disabled = true; 195 211 pushSwitch.disabled = true;
console.log('Ooops Push has been Blocked', 196 212 console.log('Ooops Push has been Blocked',
'Unfortunately the user permanently blocked push. Please unblock / ' + 197 213 'Unfortunately the user permanently blocked push. Please unblock / ' +
'allow them to switch on push notifications.'); 198 214 'allow them to switch on push notifications.');
break; 199 215 break;
case 'granted': 200 216 case 'granted':
// Set the state of the push switch 201 217 // Set the state of the push switch
console.log('case granted'); 202 218 console.log('case granted');
break; 203 219 break;
case 'prompt': 204 220 case 'prompt':
pushSwitch.checked = false; 205 221 pushSwitch.checked = false;
console.log('case prompt'); 206 222 console.log('case prompt');
break; 207 223 break;
} 208 224 }
} 209 225 }
210 226
function setUpPushPermission() { 211 227 function setUpPushPermission() {
navigator.permissions.query({name: 'push', userVisibleOnly: true}) 212 228 navigator.permissions.query({name: 'push', userVisibleOnly: true})
.then(function(permissionStatus) { 213 229 .then(function(permissionStatus) {
// Set the initial state 214 230 // Set the initial state
permissionStatusChange(permissionStatus); 215 231 permissionStatusChange(permissionStatus);
216 232
// Handle Permission State Changes 217 233 // Handle Permission State Changes
permissionStatus.onchange = function() { 218 234 permissionStatus.onchange = function() {
permissionStatusChange(this); 219 235 permissionStatusChange(this);
}; 220 236 };
221 237
// Check if push is supported and what the current state is 222 238 // Check if push is supported and what the current state is
navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { 223 239 navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
// Let's see if we have a subscription already 224 240 // Let's see if we have a subscription already
serviceWorkerRegistration.pushManager.getSubscription() 225 241 serviceWorkerRegistration.pushManager.getSubscription()
.then(function(subscription) { 226 242 .then(function(subscription) {
if (!subscription) { 227 243 if (!subscription) {
// NOOP 228 244 // NOOP
return; 229 245 return;
} 230 246 }
231 247
console.log('update current state.'); 232 248 console.log('update current state.');
// Update the current state with the 233 249 // Update the current state with the
// subscriptionid and endpoint 234 250 // subscriptionid and endpoint
onPushSubscription(subscription); 235 251 onPushSubscription(subscription);
}) 236 252 })
.catch(function(e) { 237 253 .catch(function(e) {
console.log('An error occured while calling getSubscription()', e); 238 254 console.log('An error occured while calling getSubscription()', e);
}); 239 255 });
}); 240 256 });
}).catch(function(err) { 241 257 }).catch(function(err) {
console.log('Ooops Unable to check the permission', 242 258 console.log('Ooops Unable to check the permission',
'Unfortunately the permission for push notifications couldn\'t be ' + 243 259 'Unfortunately the permission for push notifications couldn\'t be ' +
'checked. Are you on Chrome 43+?'); 244 260 'checked. Are you on Chrome 43+?');
}); 245 261 });
} 246 262 }
247 263
function setUpNotificationPermission() { 248 264 function setUpNotificationPermission() {
console.log('setting notification setting'); 249 265 console.log('setting notification setting');
250 266
if (Notification.permission === 'default') { 251 267 if (Notification.permission === 'default') {
console.log('notification permissions === default'); 252 268 console.log('notification permissions === default');
return; 253 269 return;
} 254 270 }
255 271
// Check if push is supported and what the current state is 256 272 // Check if push is supported and what the current state is
navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { 257 273 navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
// Let's see if we have a subscription already 258 274 // Let's see if we have a subscription already
serviceWorkerRegistration.pushManager.getSubscription() 259 275 serviceWorkerRegistration.pushManager.getSubscription()
.then(function(subscription) { 260 276 .then(function(subscription) {
if (!subscription) { 261 277 if (!subscription) {
// NOOP 262 278 // NOOP
console.log('not subscription'); 263 279 console.log('not subscription');
return; 264 280 return;
} 265 281 }
266 282
// Update the current state with the 267 283 // Update the current state with the
// subscriptionid and endpoint 268 284 // subscriptionid and endpoint
console.log('onpushsubscription should be entered'); 269 285 console.log('onpushsubscription should be entered');
onPushSubscription(subscription); 270 286 onPushSubscription(subscription);
}) 271 287 })
.catch(function(e) { 272 288 .catch(function(e) {
console.log('An error occured while calling getSubscription()', e); 273 289 console.log('An error occured while calling getSubscription()', e);
}); 274 290 });
}); 275 291 });
} 276 292 }
277 293
// Once the service worker is registered set the initial state 278 294 // Once the service worker is registered set the initial state
function initialiseState() { 279 295 function initialiseState() {
// Check if notifications are supported 280 296 // Check if notifications are supported
if (!('showNotification' in ServiceWorkerRegistration.prototype)) { 281 297 if (!('showNotification' in ServiceWorkerRegistration.prototype)) {
console.warn('Notifications aren\'t supported.'); 282 298 console.warn('Notifications aren\'t supported.');
return; 283 299 return;
} 284 300 }
// Check the current Notification permission. 285 301 // Check the current Notification permission.
// If its denied, it's a permanent block until the 286 302 // If its denied, it's a permanent block until the
// user changes the permission 287 303 // user changes the permission
else if (Notification.permission === 'denied') { 288 304 else if (Notification.permission === 'denied') {
console.log('Ooops Notifications are Blocked', 289 305 console.log('Ooops Notifications are Blocked',
'Unfortunately notifications are permanently blocked. Please unblock / ' + 290 306 'Unfortunately notifications are permanently blocked. Please unblock / ' +
'allow them to switch on push notifications.'); 291 307 'allow them to switch on push notifications.');
return; 292 308 return;
} 293 309 }
// Check if push messaging is supported 294 310 // Check if push messaging is supported
else if (!('PushManager' in window)) { 295 311 else if (!('PushManager' in window)) {
console.warn('Push messaging isn\'t supported.'); 296 312 console.warn('Push messaging isn\'t supported.');
return; 297 313 return;
} 298 314 }
299 315
pushSwitch.disabled = false; 300 316 pushSwitch.disabled = false;
// Is the Permissions API supported 301 317 // Is the Permissions API supported
if ('permissions' in navigator) { 302 318 if ('permissions' in navigator) {
console.log('setting push permissions'); 303 319 console.log('setting push permissions');
setUpPushPermission(); 304 320 setUpPushPermission();
return; 305 321 return;
} else { 306 322 } else {
console.log('setting notification permissions'); 307 323 console.log('setting notification permissions');
setUpNotificationPermission(); 308 324 setUpNotificationPermission();
} 309 325 }
} 310 326 }
311 327
var enablePushSwitch = $('.js-checkbox'); 312 328 var enablePushSwitch = $('.js-checkbox');
313 329
var pushSwitch = document.getElementById('notifbox'); 314 330 var pushSwitch = document.getElementById('notifbox');
pushSwitch.disabled = true; 315 331 pushSwitch.disabled = true;
316 332
var ua = navigator.userAgent.toLowerCase(); 317 333 var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf('android') > -1; //&& ua.indexOf("mobile"); 318 334 var isAndroid = ua.indexOf('android') > -1; //&& ua.indexOf("mobile");
$scope.showNotif = isAndroid; 319 335 $scope.showNotif = isAndroid;
templates/settings.html View file @ 1a503d3
<div class="row" ng-show="showNotif"> 1 1 <div class="row" ng-show="showNotif">
<div class="col s12 m8 offset-m2 l6 offset-l3"> 2 2 <div class="col s12 m8 offset-m2 l6 offset-l3">
<div class="card-panel"> 3 3 <div class="card-panel">
<h2 class="weight">Notification Settings</h2> 4 4 <h2 class="weight">Notification Settings</h2>
<!-- 5 5 <!--
class="js-checkbox" name="notifbox" value="toggle notifs"> --> 6 6 class="js-checkbox" name="notifbox" value="toggle notifs"> -->
<form action="#"> 7 7 <form action="#">
<input type="checkbox" id="notifbox" class="js-checkbox"/> 8 8 <input type="checkbox" id="notifbox" class="js-checkbox"/>
<label for="notifbox">Enable notifications</label> 9 9 <label for="notifbox">Enable notifications</label>
</form> 10 10 </form>
</div> 11 11 </div>
</div> 12 12 </div>
</div> 13 13 </div>
14 14
<div class="row"> 15 15 <div class="row">
<div class="col s12 m8 offset-m2 l6 offset-l3"> 16 16 <div class="col s12 m8 offset-m2 l6 offset-l3">
<div class="card-panel"> 17 17 <div class="card-panel">
18 18
<h2 class="weight">Change Password</h2> 19 19 <h2 class="weight">Change Password</h2>
20 20
<form name="ChangePasswordForm"> 21 21 <form name="ChangePasswordForm">
22 22
<div class="row"> 23 23 <div class="row">
<div class="input-field col s12"> 24 24 <div class="input-field col s12">
<input id="password" required ng-minlegnth=1 type="password" name="oldpw" ng-model="oldPassword" class="validate"> 25 25 <input id="password" required ng-minlength=8 type="password" name="oldpw" ng-model="oldPassword" class="validate">
<label for="password">Old Password</label> 26 26 <label for="password">Old Password</label>
</div> 27 27 </div>
</div> 28 28 </div>
29 29
30 30
<div class="row"> 31 31 <div class="row">
<div class="input-field col s12"> 32 32 <div class="input-field col s12">
<input id="password" required ng-minlength=8 type="password" name="newpw" ng-model="newPassword" 33 33 <input id="password" required ng-minlength=8 type="password" name="newpw" ng-model="newPassword"
class="validate"> 34 34 class="validate">
<label for="password">New Password</label> 35 35 <label for="password">New Password</label>
</div> 36 36 </div>
</div> 37 37 </div>
38 38
<div role="alert"> 39 39 <div role="alert">
<span style="color:#8E2323" class="error" ng-show="ChangePasswordForm.newpw.$error.minlength"> 40 40 <span style="color:#8E2323" class="error" ng-show="unacceptable && ChangePasswordForm.newpw.$error.minlength">
New password must be at least 8 characters. </span> 41 41 New password must be at least 8 characters. </span>
</div> 42 42 </div>
43 43
<div class="row"> 44 44 <div class="row">
<div class="input-field col s12"> 45 45 <div class="input-field col s12">
<input id="password" required ng-minlength=8 compare-to="newPasword" type="password" name="confirmpw" 46 46 <input id="password" required ng-minlength=8 compare-to="newPasword" type="password" name="confirmpw"
ng-model="confirmedNewPassword" class="validate"> 47 47 ng-model="confirmedNewPassword" class="validate">
<label for="password">Confirm New Password</label> 48 48 <label for="password">Confirm New Password</label>
</div> 49 49 </div>
</div> 50 50 </div>
51 51
<div role="alert" ng-show="mismatch && newPassword != confirmPassword"> 52 52 <div role="alert" ng-show="mismatch && newPassword != confirmPassword">
<span style="color:#8E2323">Passwords do not match!</span> 53 53 <span style="color:#8E2323">Passwords do not match!</span>
</div> 54 54 </div>
55 55
56
</form> 57
<a class="waves-effect waves-light btn" id="resetPWButton" 58 56 <a class="waves-effect waves-light btn" id="resetPWButton"
ng-click="changePassword(oldPassword, newPassword, confirmedNewPassword)">Submit</a> 59 57 ng-click="changePassword(oldPassword, newPassword, confirmedNewPassword)">Submit</a>
58
59 </form>
60
</div> 60 61 </div>
</div> 61 62 </div>
</div> 62 63 </div>
63 64
<div class="row"> 64 65 <div class="row">
<div class="col s12 m8 offset-m2 l6 offset-l3"> 65 66 <div class="col s12 m8 offset-m2 l6 offset-l3">
<div class="card-panel"> 66 67 <div class="card-panel">
67 68
<h2 class="weight">Enrolled Classes</h2> 68 69 <h2 class="weight">Enrolled Classes</h2>
69 70
<div class="row" style="padding: 0px 25px"> 70 71 <div class="row" style="padding: 0px 25px">
<table class="hoverable"> 71 72 <table class="hoverable">
<thead> 72 73 <thead>
<tr> 73 74 <tr>
<th data-field="id">Class</th> 74 75 <th data-field="id">Class</th>
<th data-field="drop">Drop</th> 75 76 <th data-field="drop">Drop</th>
</tr> 76 77 </tr>
</thead> 77 78 </thead>
78 79
<tbody> 79 80 <tbody>