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

Commit 875c25c

Browse files
committed
Merge branch 'dev' of github.com:appirio-tech/topcoder-app into tom-template-shuffle
2 parents b6cc272 + 854d0a8 commit 875c25c

33 files changed

+347
-199
lines changed

app/account/login/login.controller.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
function LoginController($log, $state, $stateParams, TcAuthService, AuthTokenService, UserService, NotificationService, Helpers) {
99
var vm = this;
10+
vm.$stateParams = $stateParams;
1011
vm.passwordReset = false;
1112
vm.usernameExists = true;
1213

@@ -57,7 +58,11 @@
5758
}
5859

5960
vm.login = function() {
61+
vm.usernameExists = true;
62+
vm.wrongPassword = false;
63+
6064
if (Helpers.isEmail(vm.username)) {
65+
vm.emailOrUsername = 'email';
6166
// ensure email exists
6267
UserService.validateUserEmail(vm.username).then(function(data) {
6368
if (data.valid) {
@@ -74,10 +79,11 @@
7479
_doLogin(vm.username, vm.password);
7580
});
7681
} else {
82+
vm.emailOrUsername = 'username';
7783
// username - make sure it exists
7884
UserService.validateUserHandle(vm.username).then(function(data) {
7985
if (data.valid) {
80-
// email doesn't exist
86+
// username doesn't exist
8187
vm.usernameExists = false;
8288
} else {
8389
vm.usernameExists = true;
@@ -100,8 +106,6 @@
100106
callbackUrl = $state.href('login', params, {absolute: true});
101107
TcAuthService.socialLogin(backend, callbackUrl);
102108
};
103-
104-
vm.$stateParams = $stateParams;
105109
}
106110

107111
})();

app/account/login/login.jade

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
.login-container
22
h1 Login
33

4-
form(name="loginForm", role="form", ng-submit="loginForm.$valid && vm.login()", novalidate)
4+
form(name="vm.loginForm", role="form", ng-submit="vm.loginForm.$valid && vm.login()", novalidate)
55
.form-errors
6+
p.form-error(ng-hide="vm.usernameExists") We couldn't find a member with that {{vm.emailOrUsername || "username"}}. Please check that you entered it correctly.
67

7-
p.form-error(ng-hide="vm.usernameExists") This user does not exist.
8-
9-
p.form-error(ng-show="vm.wrongPassword") That password doesn't match the one we have on file. Please try again.
8+
p.form-error(ng-show="vm.wrongPassword") That password is incorrect. Please check that you entered the right one.
109

1110
p.form-error(ng-show="vm.socialLoginError === 401") User with that profile is not registered.
1211

13-
div(ng-show="loginForm.$submitted")
14-
p.form-error(ng-show="loginForm.username.$error.required") Please enter your username or email.
15-
1612
div.validation-bar(ng-class="{'error-bar': !vm.usernameExists}")
17-
input(ng-model="vm.username", ng-blur="vm.usernameExists = true", name="username", placeholder="Username or Email", type="text", required)
13+
input(ng-model="vm.username", name="username", placeholder="Username or Email", type="text", required)
1814

1915
input(ng-model="vm.password", name="password", placeholder="Password", type="password", required)
2016

21-
button(type="submit", ng-disabled="loginForm.$invalid", ng-class="{'enabled-button': loginForm.$valid}") Login
17+
button(type="submit", ng-disabled="vm.loginForm.$invalid", ng-class="{'enabled-button': vm.loginForm.$valid}") Log In
2218

2319
section.social
24-
p log in with another account
20+
p Log in with another account
2521

2622
.social-icons
2723
i.fa.fa-github-square(ng-click="vm.socialLogin('github')")
2824
i.fa.fa-facebook-square(ng-click="vm.socialLogin('facebook')")
2925
i.fa.fa-google-plus-square(ng-click="vm.socialLogin('google-oauth2')")
3026
i.fa.fa-twitter-square(ng-click="vm.socialLogin('twitter')")
3127

32-
a.forgot-password(ui-sref="resetPassword") Forgot Password?
28+
a.forgot-password(ui-sref="resetPassword") Forgot your password?
3329

34-
p.redirect Don't have an account?
35-
a(ui-sref="register(vm.$stateParams)") Join Now.
30+
p.redirect Not a member yet?
31+
a(ui-sref="register(vm.$stateParams)") Join now.
3632

app/account/register/register.jade

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
input(right-placeholder, focused-placeholder="Last", ng-model="vm.lastname", maxlength="64", name="lastname", placeholder="Last Name", type="text", required)
1515

16-
//- Show errors for first and last names once we know whether we can handle accents, other languages, and not symbols/numbers
17-
//- .form-errors
18-
//- p.form-error(ng-show="vm.registerForm.firstname.$dirty && vm.registerForm.firstname.$error.pattern") Names must not contain symbols or numbers.
19-
2016
.country-dropdown
2117
angucomplete-alt(
2218
input-name="country",
@@ -32,68 +28,68 @@
3228
)
3329

3430
.form-errors
35-
p.form-error(ng-show="vm.registerForm.country.$error.required") Please enter a valid country.
31+
p.form-error(ng-show="vm.registerForm.country.$error.required") Please choose a country from the list.
3632

3733
.validation-bar(ng-class="{ 'error-bar': (vm.registerForm.username.$error.usernameIsFree || vm.registerForm.username.$error.minlength || vm.registerForm.username.$error.maxlength), 'success-bar': (vm.registerForm.username.$valid && !vm.registerForm.username.$error.usernameIsFree) }")
3834
input(right-placeholder, focused-placeholder="Username", ng-model="vm.username", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.usernameTips = true", ng-blur="vm.usernameTips = false", ng-minlength="2", ng-maxlength="15", name="username", placeholder="Username", type="text", username-is-free, required)
3935

4036
.tips.username-tips(ng-show="vm.usernameTips")
4137
h3 Username Tips:
4238

43-
p This will be public to other members
44-
45-
p Between 2 and 15 characters
39+
p Your username will be public
4640

47-
p Can contain numbers and letters
41+
p Please choose one that is between 2 and 15 characters
4842

49-
p You can always change it later
43+
p It can contain letters, numbers, and these characters: -_.{}[]
5044

5145
.form-errors
52-
p.form-error(ng-show="vm.registerForm.username.$error.usernameIsFree") This username already exists.
46+
p.form-error(ng-show="vm.registerForm.username.$dirty && vm.registerForm.username.$error.usernameIsFree", ng-bind="vm.usernameErrorMessage")
5347

54-
p.form-error(ng-show="vm.registerForm.username.$error.minlength || vm.registerForm.username.$error.maxlength") Username must be between 2 and 15 characters.
48+
p.form-error(ng-show="vm.registerForm.username.$dirty && (vm.registerForm.username.$error.minlength || vm.registerForm.username.$error.maxlength)") That username is not the correct length or format.
5549

5650
.validation-bar(ng-class="{ 'error-bar': (vm.registerForm.email.$dirty && vm.registerForm.email.$invalid), 'success-bar': (vm.registerForm.email.$valid) }")
57-
input(right-placeholder, focused-placeholder="Email", ng-model="vm.email", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="Enter Your Email", type="email", valid-email, email-is-available, required)
51+
input(right-placeholder, focused-placeholder="Email", ng-model="vm.email", ng-model-options="{ debounce: {'default': 500} }", ng-focus="vm.emailTips = true", ng-blur="vm.emailTips = false", name="email", placeholder="Enter Your Email", type="email", valid-email, email-is-available, required)
5852

5953
.tips.email-tips(ng-show="vm.emailTips")
6054
h3 Email Tips:
6155

62-
p This will be private and not shared with anyone.
56+
p Your email address will be private and not shared with anyone.
6357

64-
p We will occasionally send you emails related to your account or interests.
58+
p We'll occasionally send you emails related to your activities or interests.
6559

6660
.form-errors
67-
p.form-error(ng-show="vm.registerForm.email.$dirty && vm.registerForm.email.$invalid") Please enter a valid email address.
61+
p.form-error(ng-show="vm.registerForm.email.$dirty && (vm.registerForm.email.$error.emailIsAvailable || vm.registerForm.email.$error.validEmail)", ng-bind="vm.emailErrorMessage")
62+
63+
p.form-error(ng-show="vm.registerForm.email.$dirty && vm.registerForm.email.$error.required") Please enter an email address.
6864

6965
.validation-bar(ng-class="{ 'success-bar': (vm.registerForm.password.$valid) }")
70-
toggle-password(ng-if="!vm.isSocialRegistration")
66+
toggle-password-with-tips(ng-if="!vm.isSocialRegistration")
7167

7268
.tips.password-tips(ng-show="vm.passwordFocus")
7369
h3 Password Tips:
7470

75-
p(ng-class="{ 'has-length-between-range': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.minlength && !vm.registerForm.password.$error.maxlength && !vm.registerForm.password.$error.required) }") Must be between 8 and 64 characters
71+
p Your password must have:
7672

77-
p(ng-class="{ 'has-letter': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasLetter) }") At least one letter
73+
p(ng-class="{ 'has-length-between-range': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.minlength && !vm.registerForm.password.$error.maxlength && !vm.registerForm.password.$error.required) }") At least 8 characters
7874

79-
p(ng-class="{ 'has-symbol': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasSymbol) }") At least one symbol
75+
p(ng-class="{ 'has-letter': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasLetter) }") At least one letter
8076

81-
p(ng-class="{ 'has-number': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasNumber) }") At least one number
77+
p(ng-class="{ 'has-symbol-or-number': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasSymbolOrNumber) }") At least one number or symbol
8278

8379
button(type="submit", ng-disabled="vm.registerForm.$invalid", ng-class="{'enabled-button': vm.registerForm.$valid}") Join Now
8480

8581
section.terms
86-
p By clicking "JOIN NOW" I agree to Topcoder's
82+
p By clicking "JOIN NOW" you agree to Topcoder's
8783

8884
p #[a(href="http://www.topcoder.com/community/how-it-works/terms/", target="_blank") Terms of Service] and #[a(href="http://www.topcoder.com/community/how-it-works/privacy-policy/", target="_blank") Privacy Policy]
8985

9086
section.social
91-
p Register using another account.
87+
p Use an existing account to register.
9288

9389
.social-icons
9490
i.fa.fa-github-square(ng-click="vm.socialRegister('github')")
9591
i.fa.fa-facebook-square(ng-click="vm.socialRegister('facebook')")
9692
i.fa.fa-google-plus-square(ng-click="vm.socialRegister('google-oauth2')")
9793

98-
p.redirect Already have an account?
99-
a(ui-sref="login(vm.$stateParams)") Login.
94+
p.redirect Already a member?
95+
a(ui-sref="login(vm.$stateParams)") Log in.

app/account/reset-password/reset-password.jade

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
form.reset-form(name='vm.resetPasswordForm', role="form", ng-submit="vm.resetPasswordForm.$valid && vm.resetPassword()", novalidate)
3737

3838
.validation-bar(ng-class="{ 'success-bar': (vm.resetPasswordForm.password.$valid) }")
39-
toggle-password
39+
toggle-password-with-tips
4040

4141
.tips.password-tips(ng-show="vm.passwordFocus")
4242
h3 Password Tips:
@@ -45,9 +45,7 @@
4545

4646
p(ng-class="{ 'has-letter': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasLetter) }") At least one letter
4747

48-
p(ng-class="{ 'has-symbol': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasSymbol) }") At least one symbol
49-
50-
p(ng-class="{ 'has-number': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasNumber) }") At least one number
48+
p(ng-class="{ 'has-symbol-or-number': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasSymbolOrNumber) }") At least one number or symbol
5149

5250
.form-errors
5351
p.form-error(ng-show="vm.resetFailed") We were unable to reset your password. Please request another reset link. If you continue to have trouble, please contact
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('togglePasswordWithTips', togglePasswordWithTips);
5+
6+
function togglePasswordWithTips() {
7+
return {
8+
restrict: 'E',
9+
require: '^form',
10+
templateUrl: 'directives/account/toggle-password-with-tips/toggle-password-with-tips.html',
11+
link: function(scope, element, attrs, formController) {
12+
var vm = scope.vm;
13+
vm.passwordField = formController.password;
14+
vm.placeholder = vm.defaultPlaceholder;
15+
vm.password = '';
16+
17+
var passwordInput = element.children()[0];
18+
19+
element.bind('click', function(event) {
20+
passwordInput.focus();
21+
});
22+
23+
element.bind('keyup', function(event) {
24+
if (event.keyCode === 13) {
25+
passwordInput.blur();
26+
}
27+
});
28+
29+
vm.onFocus = function(event) {
30+
vm.passwordFocus = true;
31+
vm.placeholder = '';
32+
}
33+
34+
vm.onBlur = function(event) {
35+
var relatedTarget = angular.element(event.relatedTarget);
36+
37+
// If you are blurring from the password input and clicking the checkbox
38+
if (relatedTarget.attr('type') === 'checkbox' && relatedTarget.attr('id') === 'passwordCheckbox') {
39+
vm.passwordFocus = true;
40+
vm.placeholder = '';
41+
} else {
42+
// If you are blurring from the password input and clicking anywhere but the checkbox
43+
vm.passwordFocus = false;
44+
45+
if (vm.password === '' || vm.password === undefined) {
46+
vm.placeholder = vm.defaultPlaceholder;
47+
formController.password.$setPristine();
48+
}
49+
}
50+
};
51+
52+
vm.toggleInputType = function() {
53+
var $passwordInput = angular.element(passwordInput);
54+
55+
if ($passwordInput.attr('type') === 'text') {
56+
$passwordInput.attr('type', 'password');
57+
} else {
58+
$passwordInput.attr('type', 'text');
59+
}
60+
}
61+
}
62+
};
63+
}
64+
})();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
input#password-input(
2+
ng-model="vm.password",
3+
ng-model-options="{allowInvalid: true}",
4+
5+
ng-hide="vm.isSocialRegistration",
6+
focus-on="focusOnInput",
7+
8+
ng-focus="vm.onFocus($event)",
9+
ng-blur="vm.onBlur($event)",
10+
11+
name="password",
12+
type="password",
13+
placeholder="{{vm.placeholder}}",
14+
15+
ng-minlength="8",
16+
ng-maxlength="64",
17+
has-letter,
18+
has-symbol-or-number,
19+
required)
20+
21+
label(ng-show="vm.passwordFocus || vm.passwordField.$dirty") #[input(type="checkbox", id="passwordCheckbox", ng-model="focusOnInput", ng-change="vm.toggleInputType()")] Show
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* jshint -W117, -W030 */
2+
describe('Toggle Password With Tips Directive', function() {
3+
var scope;
4+
var element;
5+
// var challenge = mockData.getMockChallengeWithUserDetails();
6+
// var spotlightChallenge = mockData.getMockSpotlightChallenges()[0];
7+
8+
beforeEach(function() {
9+
bard.appModule('topcoder');
10+
bard.inject(this, '$compile', '$rootScope');
11+
scope = $rootScope.$new();
12+
});
13+
14+
bard.verifyNoOutstandingHttpRequests();
15+
});

app/directives/account/toggle-password/toggle-password.directive.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,52 @@
1010
templateUrl: 'directives/account/toggle-password/toggle-password.html',
1111
link: function(scope, element, attrs, formController) {
1212
var vm = scope.vm;
13-
vm.passwordField = formController.password;
14-
vm.placeholder = vm.defaultPlaceholder;
15-
vm.password = '';
13+
vm.currentPasswordField = formController.currentPassword;
14+
vm.currentPasswordPlaceholder = vm.currentPasswordDefaultPlaceholder;
15+
vm.currentPassword = '';
1616

17-
var passwordInput = element.children()[0];
17+
var currentPasswordInput = element.children()[0];
1818

1919
element.bind('click', function(event) {
20-
passwordInput.focus();
20+
currentPasswordInput.focus();
2121
});
2222

2323
element.bind('keyup', function(event) {
2424
if (event.keyCode === 13) {
25-
passwordInput.blur();
25+
currentPasswordInput.blur();
2626
}
2727
});
2828

29-
vm.onFocus = function(event) {
30-
vm.passwordFocus = true;
31-
vm.placeholder = '';
29+
vm.onCPFocus = function(event) {
30+
vm.currentPasswordFocus = true;
31+
vm.currentPasswordPlaceholder = '';
3232
}
3333

34-
vm.onBlur = function(event) {
34+
vm.onCPBlur = function(event) {
3535
var relatedTarget = angular.element(event.relatedTarget);
3636

3737
// If you are blurring from the password input and clicking the checkbox
38-
if (relatedTarget.attr('type') === 'checkbox') {
39-
vm.passwordFocus = true;
40-
vm.placeholder = '';
38+
if (relatedTarget.attr('type') === 'checkbox' && relatedTarget.attr('id') === 'currentPasswordCheckbox') {
39+
vm.currentPasswordFocus = true;
40+
vm.currentPasswordPlaceholder = '';
4141
} else {
4242
// If you are blurring from the password input and clicking anywhere but the checkbox
43-
vm.passwordFocus = false;
43+
vm.currentPasswordFocus = false;
4444

45-
if (vm.password === '' || vm.password === undefined) {
46-
vm.placeholder = vm.defaultPlaceholder;
47-
formController.password.$setPristine();
45+
if (vm.currentPassword === '' || vm.currentPassword === undefined) {
46+
vm.currentPasswordPlaceholder = vm.currentPasswordDefaultPlaceholder;
47+
formController.currentPassword.$setPristine();
4848
}
4949
}
5050
};
5151

52-
vm.toggleInputType = function() {
53-
var $passwordInput = angular.element(passwordInput);
52+
vm.toggleTypeAttribute = function() {
53+
var $currentPasswordInput = angular.element(currentPasswordInput);
5454

55-
if ($passwordInput.attr('type') === 'text') {
56-
$passwordInput.attr('type', 'password');
55+
if ($currentPasswordInput.attr('type') === 'text') {
56+
$currentPasswordInput.attr('type', 'password');
5757
} else {
58-
$passwordInput.attr('type', 'text');
58+
$currentPasswordInput.attr('type', 'text');
5959
}
6060
}
6161
}

0 commit comments

Comments
 (0)