Commit 403520b52da3ef3cfba13229ebd93ba8aac58f28
1 parent
3489a985d7
Exists in
master
and in
1 other branch
added verify email
Showing 4 changed files with 46 additions and 1 deletions Side-by-side Diff
config.js
View file @
403520b
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | 'flashy.UserService', |
11 | 11 | 'flashy.FlashcardDirective', |
12 | 12 | 'flashy.ResetPasswordController', |
13 | + 'flashy.VerifyEmailController', | |
13 | 14 | 'ngCookies']). |
14 | 15 | config(['$stateProvider', '$urlRouterProvider', '$httpProvider', |
15 | 16 | '$locationProvider', |
16 | 17 | |
... | ... | @@ -70,7 +71,11 @@ |
70 | 71 | url: '/resetpassword/{uid}/{token}', |
71 | 72 | templateUrl: 'templates/resetpassword.html', |
72 | 73 | controller: 'ResetPasswordController' |
74 | + }). | |
75 | + state('verifyemail', { | |
76 | + url: '/verifyemail/{key}', | |
77 | + templateUrl: 'templates/verifyemail.html', | |
78 | + controller: 'VerifyEmailController' | |
73 | 79 | }); |
74 | - | |
75 | 80 | }]); |
home.html
View file @
403520b
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | <script src="scripts/RequestResetController.js"></script> |
37 | 37 | <script src="scripts/ClassAddController.js"></script> |
38 | 38 | <script src="scripts/ReviewController.js"></script> |
39 | +<script src="scripts/VerifyEmailController.js"></script> | |
39 | 40 | |
40 | 41 | <!-- Services --> |
41 | 42 | <script src="scripts/UserService.js"></script> |
scripts/VerifyEmailController.js
View file @
403520b
1 | +angular.module('flashy.VerifyEmailController', ['ui.router']) | |
2 | + | |
3 | + .controller('VerifyEmailController', ['$scope', '$state', '$http', '$timeout', | |
4 | + function($scope, $state, $http, $timeout) { | |
5 | + 'use strict'; | |
6 | + var url = document.location.href.split('/'); | |
7 | + var key = url[url.length-1]; | |
8 | + $scope.success = false; | |
9 | + $scope.error = false; | |
10 | + | |
11 | + $http.patch('/api/me', JSON.stringify({ | |
12 | + 'confirmation_key': key | |
13 | + })) | |
14 | + .success(function(data) { | |
15 | + $scope.success = true; | |
16 | + console.log("SUCCESS"); | |
17 | + console.log(data); | |
18 | + $timeout(function($state) { | |
19 | + $state.go('feed'); | |
20 | + }, 2000); | |
21 | + }) | |
22 | + .error(function(data, status, header, config) { | |
23 | + $scope.error = true; | |
24 | + console.log("ERROR"); | |
25 | + console.log(data); | |
26 | + }); | |
27 | + } | |
28 | + ]); |
templates/verifyemail.html
View file @
403520b