Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 7c67336

Browse files
author
Nick Litwin
committed
Too many changes to make commit messages....
1 parent d2faba8 commit 7c67336

File tree

74 files changed

+1522
-876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1522
-876
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"rules": {
33
"indent": [2, 2],
4-
"quotes": [2, "single"],
54
"linebreak-style": [2, "unix"],
5+
"no-unused-vars": [2, {"args": "none"}],
6+
"quotes": [2, "single"],
67
"semi": [2, "never"]
78
},
89
"env": {

app/account/account.routes.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import angular from 'angular'
2+
13
(function() {
2-
'use strict';
4+
'use strict'
35

4-
angular.module('tc.account').config(routes);
6+
angular.module('tc.account').config(routes)
57

6-
routes.$inject = ['$locationProvider', '$stateProvider', '$urlRouterProvider'];
8+
routes.$inject = ['$locationProvider', '$stateProvider', '$urlRouterProvider']
79

810
function routes($locationProvider, $stateProvider, $urlRouterProvider) {
9-
$locationProvider.html5Mode(true);
11+
$locationProvider.html5Mode(true)
1012

1113
var states = {
1214
'auth': {
@@ -15,14 +17,14 @@
1517
data: {
1618
authRequired: false
1719
},
18-
onEnter: ['$state', '$stateParams', 'TcAuthService', function($state, $stateParams, TcAuthService) {
20+
onEnter: ['$state', '$stateParams', 'TcAuthService', '$log', function($state, $stateParams, TcAuthService, $log) {
1921
if (TcAuthService.isAuthenticated()) {
2022
// redirect to next if exists else dashboard
2123
if ($stateParams.next) {
22-
$log.debug('Redirecting: ' + $stateParams.next);
23-
window.location.href = decodeURIComponent($stateParams.next);
24+
$log.debug('Redirecting: ' + $stateParams.next)
25+
window.location.href = decodeURIComponent($stateParams.next)
2426
} else {
25-
$state.go('dashboard');
27+
$state.go('dashboard')
2628
}
2729
}
2830
}]
@@ -36,35 +38,35 @@
3638
},
3739
views: {
3840
'header@': {
39-
templateUrl: 'layout/header/account-header.html'
41+
template: require('../layout/header/account-header')()
4042
},
4143
'container@': {
42-
templateUrl: 'account/login/login.html',
44+
template: require('./login/login')(),
4345
controller: 'LoginController',
4446
controllerAs: 'vm'
4547
},
4648
'footer@': {
47-
templateUrl: 'layout/footer/account-footer.html'
49+
template: require('../layout/footer/account-footer')()
4850
}
4951
}
5052
},
5153
'register': {
5254
parent: 'auth',
5355
url: '/register/?next&utm_source&utm_medium&utm_campaign',
5456
data: {
55-
title: "Join"
57+
title: 'Join'
5658
},
5759
views: {
5860
'header@': {
59-
templateUrl: 'layout/header/account-header.html'
61+
template: require('../layout/header/account-header')()
6062
},
6163
'container@': {
62-
templateUrl: 'account/register/register.html',
64+
template: require('./register/register')(),
6365
controller: 'RegisterController',
6466
controllerAs: 'vm'
6567
},
6668
'footer@': {
67-
templateUrl: 'layout/footer/account-footer.html'
69+
template: require('../layout/footer/account-footer')()
6870
}
6971
}
7072
},
@@ -76,33 +78,33 @@
7678
},
7779
views: {
7880
'header@': {
79-
templateUrl: 'layout/header/account-header.html'
81+
template: require('../layout/header/account-header')()
8082
},
8183
'container@': {
82-
templateUrl: 'account/register/registered-successfully.html'
84+
template: require('./register/registered-successfully')()
8385
},
8486
'footer@': {
85-
templateUrl: 'layout/footer/account-footer.html'
87+
template: require('../layout/footer/account-footer')()
8688
}
8789
}
8890
},
8991
'resetPassword': {
9092
parent: 'auth',
9193
url: '/reset-password/?token&handle',
9294
data: {
93-
title: "Reset Password"
95+
title: 'Reset Password'
9496
},
9597
views: {
9698
'header@': {
97-
templateUrl: 'layout/header/account-header.html'
99+
template: require('../layout/header/account-header')()
98100
},
99101
'container@': {
100-
templateUrl: 'account/reset-password/reset-password.html',
102+
template: require('./reset-password/reset-password')(),
101103
controller: 'ResetPasswordController',
102104
controllerAs: 'vm'
103105
},
104106
'footer@': {
105-
templateUrl: 'layout/footer/account-footer.html'
107+
template: require('../layout/footer/account-footer')()
106108
}
107109
}
108110
},
@@ -119,10 +121,10 @@
119121
authRequired: false
120122
}
121123
}
122-
};
124+
}
123125

124126
angular.forEach(states, function(state, name) {
125-
$stateProvider.state(name, state);
126-
});
127+
$stateProvider.state(name, state)
128+
})
127129
}
128-
})();
130+
})()

app/account/login/login.controller.js

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,135 @@
1+
import angular from 'angular'
2+
13
(function() {
2-
'use strict';
4+
'use strict'
35

4-
angular.module('tc.account').controller('LoginController', LoginController);
6+
angular.module('tc.account').controller('LoginController', LoginController)
57

6-
LoginController.$inject = ['$log', '$state', '$stateParams', '$location', '$scope', 'TcAuthService', 'UserService', 'NotificationService', 'Helpers', 'CONSTANTS'];
8+
LoginController.$inject = ['$log', '$state', '$stateParams', '$location', '$scope', 'TcAuthService', 'UserService', 'NotificationService', 'Helpers', 'CONSTANTS']
79

810
function LoginController($log, $state, $stateParams, $location, $scope, TcAuthService, UserService, NotificationService, Helpers, CONSTANTS) {
9-
var vm = this;
10-
$log = $log.getInstance("LoginController");
11-
vm.$stateParams = $stateParams;
12-
vm.passwordReset = false;
11+
var vm = this
12+
$log = $log.getInstance('LoginController')
13+
vm.$stateParams = $stateParams
14+
vm.passwordReset = false
1315
vm.loginErrors = {
1416
USERNAME_NONEXISTANT: false,
1517
WRONG_PASSWORD: false,
1618
SOCIAL_LOGIN_ERROR: false
17-
};
19+
}
1820

19-
vm.login = login;
20-
vm.socialLogin = socialLogin;
21+
vm.login = login
22+
vm.socialLogin = socialLogin
2123

2224
// reference for main vm
23-
var mainVm = $scope.$parent.main;
25+
var mainVm = $scope.$parent.main
2426

25-
activate();
27+
activate()
2628

2729
function activate() {
2830
if ($stateParams.notifyReset) {
29-
NotificationService.inform('Your new password has been set. Please log in. If you have any trouble, please contact [email protected].');
31+
NotificationService.inform('Your new password has been set. Please log in. If you have any trouble, please contact [email protected].')
3032
}
3133
}
3234

3335
function login() {
34-
vm.loginErrors.USERNAME_NONEXISTANT = false;
35-
vm.loginErrors.WRONG_PASSWORD = false;
36+
vm.loginErrors.USERNAME_NONEXISTANT = false
37+
vm.loginErrors.WRONG_PASSWORD = false
3638

3739
// TODO ideally it should be done by dedicated directive to handle all outside clicks
38-
mainVm.menuVisible = false;
40+
mainVm.menuVisible = false
3941

4042
if (Helpers.isEmail(vm.username)) {
4143
// the user is loggin in using email
42-
vm.emailOrUsername = 'email';
44+
vm.emailOrUsername = 'email'
4345

4446
// ensure email exists
4547
// uses same validity check as registration
4648
// valid => email isn't already used by someone
4749
UserService.validateUserEmail(vm.username).then(function(data) {
4850
if (data.valid) {
4951
// email doesn't exist
50-
vm.loginErrors.USERNAME_NONEXISTANT = true;
52+
vm.loginErrors.USERNAME_NONEXISTANT = true
5153
} else {
52-
_doLogin(vm.username, vm.currentPassword);
54+
_doLogin(vm.username, vm.currentPassword)
5355
}
5456
}).catch(function(resp) {
5557
// TODO handle error
5658
// assume email exists, login would in any case if it didn't
57-
vm.loginErrors.USERNAME_NONEXISTANT = false;
58-
_doLogin(vm.username, vm.currentPassword);
59-
});
59+
vm.loginErrors.USERNAME_NONEXISTANT = false
60+
_doLogin(vm.username, vm.currentPassword)
61+
})
6062
} else {
6163
// the user is logging in using a username
62-
vm.emailOrUsername = 'username';
64+
vm.emailOrUsername = 'username'
6365

6466
// username - make sure it exists
6567
UserService.validateUserHandle(vm.username).then(function(data) {
6668
if (data.valid) {
6769
// username doesn't exist
68-
vm.loginErrors.USERNAME_NONEXISTANT = true;
70+
vm.loginErrors.USERNAME_NONEXISTANT = true
6971
} else {
70-
_doLogin(vm.username, vm.currentPassword);
72+
_doLogin(vm.username, vm.currentPassword)
7173
}
7274
}).catch(function(resp) {
7375
// TODO handle error
7476
// assume email exists, login would in any case if it didn't
75-
_doLogin(vm.username, vm.currentPassword);
76-
});
77+
_doLogin(vm.username, vm.currentPassword)
78+
})
7779
}
78-
};
80+
}
7981

8082
function _doLogin(usernameOrEmail, password) {
8183
return TcAuthService.login(usernameOrEmail, password).then(function(data) {
8284
// success
83-
$log.debug('logged in');
85+
$log.debug('logged in')
8486

8587
// setup login event for analytics tracking
86-
Helpers.setupLoginEventMetrics(usernameOrEmail);
87-
return Helpers.redirectPostLogin($stateParams.next);
88+
Helpers.setupLoginEventMetrics(usernameOrEmail)
89+
return Helpers.redirectPostLogin($stateParams.next)
8890

8991
}).catch(function(resp) {
90-
$log.warn(resp);
92+
$log.warn(resp)
9193
switch (resp.status) {
92-
case "ACCOUNT_INACTIVE":
93-
$state.go('registeredSuccessfully');
94-
// user should already be redirected
95-
break;
96-
case "UNKNOWN_ERROR":
97-
default:
98-
vm.loginErrors.WRONG_PASSWORD = true;
99-
vm.password = '';
94+
case 'ACCOUNT_INACTIVE':
95+
$state.go('registeredSuccessfully')
96+
// user should already be redirected
97+
break
98+
case 'UNKNOWN_ERROR':
99+
default:
100+
vm.loginErrors.WRONG_PASSWORD = true
101+
vm.password = ''
100102
}
101-
});
103+
})
102104
}
103105

104106
function socialLogin(platform) {
105107
// we need to pass on the 'next' param if we have one
106-
var params = {};
108+
var params = {}
107109
if ($stateParams.next) {
108-
params = {next: $stateParams.next};
110+
params = {next: $stateParams.next}
109111
}
110112

111113
// redirect back to login
112-
var callbackUrl = $state.href('login', params, {absolute: true});
114+
var callbackUrl = $state.href('login', params, {absolute: true})
113115

114116
TcAuthService.socialLogin(platform, callbackUrl)
115117
.then(function() {
116-
$log.debug('logged in');
117-
return Helpers.redirectPostLogin($stateParams.next);
118+
$log.debug('logged in')
119+
return Helpers.redirectPostLogin($stateParams.next)
118120
})
119121
.catch(function(resp) {
120122
switch (resp.status) {
121123
case "ACCOUNT_INACTIVE":
122-
window.location.href = "https://www." + CONSTANTS.domain + "/account-inactive/";
124+
window.location.href = "https://www." + CONSTANTS.domain + "/account-inactive/"
123125
case "USER_NOT_REGISTERED":
124126
default:
125-
vm.socialLoginError = 401;
126-
vm.loginErrors.SOCIAL_LOGIN_ERROR = true;
127-
break;
127+
vm.socialLoginError = 401
128+
vm.loginErrors.SOCIAL_LOGIN_ERROR = true
129+
break
128130
}
129-
});
130-
};
131+
})
132+
}
131133
}
132134

133-
})();
135+
})()

app/account/login/login.jade

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
- var logoMobile = require("../../../assets/images/logo_mobile.svg")
2+
13
.login-container
24
header
35
a.logo-link(href="/", title="Back to the home page")
4-
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
6+
img(src=logoMobile, alt="Topcoder Logo")
57

68
h1 LOG IN TO TOPCODER
79

app/account/register/register.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.register-container
22
header
33
a.logo-link(href="/")
4-
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
4+
img(src=require("../../../assets/images/logo_mobile.svg"), alt="Topcoder Logo")
55
.arrow
66
//- h1 Join the Topcoder technology community to earn, learn, and connect
77
h1 Join Topcoder
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
.registered-successfully-container
2-
32
header
43
a.logo-link(href="/")
5-
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
4+
img(src=require("../../../assets/images/logo_mobile.svg"), alt="Topcoder Logo")
65
.arrow
76

87
p.message Thanks for joining Topcoder.<br> We've sent you a confirmation link. Please check your email and click the link to activate your account. If you can't find the message, please email #[a(href="mailto:[email protected]") [email protected]].

0 commit comments

Comments
 (0)