Merge pull request #323 from coralproject/more-lingering-displayname-bugs

Standardizing username
This commit is contained in:
David Erwin
2017-02-16 18:02:04 -05:00
committed by GitHub
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ const performSetup = () => {
message: 'Username',
filter: (username) => {
return UsersService
.isValidDisplayName(username, false)
.isValidUsername(username, false)
.catch((err) => {
throw err.message;
});
+1 -1
View File
@@ -79,7 +79,7 @@ function getUserCreateAnswers(options) {
message: 'Username',
filter: (username) => {
return UsersService
.isValidDisplayName(username)
.isValidUsername(username)
.catch((err) => {
throw err.message;
});
+2 -2
View File
@@ -103,9 +103,9 @@ if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET &&
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
callbackURL: `${process.env.TALK_ROOT_URL}/api/v1/auth/facebook/callback`,
// TODO: remove displayName reference when we have steps in the FE to handle
// TODO: remove username reference when we have steps in the FE to handle
// the username create flow.
profileFields: ['id', 'displayName', 'picture.type(large)']
profileFields: ['id', 'username', 'picture.type(large)']
}, (accessToken, refreshToken, profile, done) => {
UsersService
.findOrCreateExternalUser(profile)
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = class SetupService {
// Verify other properties of the user.
return Promise.all([
UsersService.isValidDisplayName(username, false),
UsersService.isValidUsername(username, false),
UsersService.isValidPassword(password),
settingsModel.validate()
]);
+2 -2
View File
@@ -176,7 +176,7 @@ module.exports = class UsersService {
* @param {Boolean} checkAgainstWordlist enables cheching against the wordlist
* @return {Promise}
*/
static isValidUserName(username, checkAgainstWordlist = true) {
static isValidUsername(username, checkAgainstWordlist = true) {
const onlyLettersNumbersUnderscore = /^[A-Za-z0-9_]+$/;
if (!username) {
@@ -230,7 +230,7 @@ module.exports = class UsersService {
username = username.trim();
return Promise.all([
UsersService.isValidUserName(username),
UsersService.isValidUsername(username),
UsersService.isValidPassword(password)
])
.then(() => { // username is valid