Compare View

switch
from
...
to
 
Commits (2)

Diff

Showing 2 changed files Inline Diff

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