Skip to content

Commit

Permalink
Merge branch 'develop' into ft_#159206051_enable_social_login
Browse files Browse the repository at this point in the history
  • Loading branch information
OKiMaureen committed Aug 3, 2018
2 parents acffb38 + a42b857 commit 89d6bd9
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 164 deletions.
33 changes: 23 additions & 10 deletions helpers/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,29 @@ export default class Utilities {
* @returns {Object} user object
*/
static userToJson(userObject, token) {
const output = {
success: true,
user: {
email: userObject.email,
token,
username: userObject.username,
bio: userObject.bio,
image: userObject.image,
},
};
let output = '';
if (token) {
output = {
success: true,
user: {
email: userObject.email,
token,
username: userObject.username,
bio: userObject.bio,
image: userObject.image,
},
};
} else {
output = {
success: true,
user: {
email: userObject.email,
username: userObject.username,
bio: userObject.bio,
image: userObject.image,
},
};
}
return output;
}
}
2 changes: 1 addition & 1 deletion helpers/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ValidateUser {
static validatePassword(str) {
const passwordFormat = /((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+[0-9a-z]+$/i;
if (!str || str.trim().length < 1) {
return { error: 'Password cannnot be empty' };
return { error: 'Password cannot be empty' };
}

if (str.trim().length < 8) {
Expand Down
Loading

0 comments on commit 89d6bd9

Please sign in to comment.