-
Notifications
You must be signed in to change notification settings - Fork 4
Profile Picture added on API and Backend #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile Picture added on API and Backend #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments;
$this->addFlash('success', $flashMsg); | ||
|
||
} catch(UploadException $e) { | ||
$this->logMessage(400, 'danger', $e->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not we use logMessageAndFlash?
// Always catch exact exception for which flash message or logger is needed, | ||
// otherwise catch block will not get executed on higher or lower ranked exceptions. | ||
} catch(UploadException $e) { | ||
$this->logMessage(400, 'danger', $e->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logMessageAndFlash?
* {"name"="dob", "dataType"="datetime", "required"=true, "description"="date of birth mm/dd/yyyy"}, | ||
* {"name"="email", "dataType"="email", "required"=true, "description"="Email"}, | ||
* {"name"="email_confirmation", "dataType"="integer", "required"=true, "description"="0-email confirmation not required, 1-required"}, | ||
* {"name"="image", "dataType"="image/jpeg, image/jpg, image/gif, image/png", "required"=false, "description"="Profile Picture within 1024k size"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where did we limit 1024K
src/ApiBundle/Entity/User.php
Outdated
|
||
/** | ||
* @var string $image | ||
* @Assert\File( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, here it is! cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, User (who is signing up) should be able add/ remove or update user profile image; not the admin only.
src/ApiBundle/Form/UserType.php
Outdated
->add('dob', DateType::class, array('widget' => 'single_text', 'format' => 'M/d/y')) | ||
->add('username', TextType::class) | ||
->add('password', PasswordType::class, array('data' => '')) | ||
->add('password', TextType::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it back to TextType?
it was chnaged to PasswordType in last PR
https://github.com/nerdapplabs/authOauth/pull/9/files#diff-3683af68b1a14d46bf30b457a8ec4ddfR31
@praveen-garg have a look. Changes are final till now. |
$user->setEmail($request->request->get('email')); | ||
$user->setFirstname($request->request->get('firstname')); | ||
$user->setLastname($request->request->get('lastname')); | ||
$user->setLastname($request->request->get('lastname') ? $request->request->get('lastname') : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not we make it EMPTY string ? ""
$user->setLastname($request->request->get('lastname') ? $request->request->get('lastname') : "");
$oAuthRtn = 'Pending'; | ||
$msg = 'N.A.'; | ||
$grantType = 'password'; | ||
$loginConfirmation = $this->container->getParameter('login_confirmation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the use of this var?
$loginConfirmation = $this->container->getParameter('login_confirmation'); | ||
|
||
if ('1' == $request->request->get('email_confirmation')) { | ||
if (true == $this->container->getParameter('email_confirmation') ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
email_confirmation > registration_requires_email_confirmation
|
||
// If no image file, then return empty response | ||
if (!$user->getImage()) { | ||
return new Response(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please explain more?
If no image file, then return empty response ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, Empty with 200 ok.
* description="Fetch User profile detail. Access token to be provided in header (Authorization = Bearer <access token>)", | ||
* parameters={ | ||
* {"name"="image", "dataType"="image/jpeg, image/jpg, image/gif, image/png", "required"=false, "description"="Profile Picture within 1024k size"}, | ||
* {"name"="image", "dataType"="image/jpeg, image/jpg, image/gif, image/png", "required"=false, "description"="jpeg/jpg/png/gif Pic Size: 1024k, Width: 50-300px, Height: 50-300px"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
older looks better!
images_profile_directory: '%kernel.root_dir%/../web%images_profile_suffix%' | ||
images_profile_directory: '%kernel.root_dir%/../web/images/profile' | ||
email_confirmation: false | ||
login_confirmation: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comments
@aksinha-nerdapplabs we must keep PR specific to the issue; not sure why this PR has registration_requires_email_confirmation related change. a new PR (with minimum & to the point chnages) could have been easy to review/ test and merge |
if ('1' == $request->request->get('email_confirmation')) { | ||
// If Login confirmation is set, then upon successful registration, user will be logged in automatically, | ||
// else user will be redirected to a login page to log in with the new credentials. | ||
$loginConfirmation = $this->container->getParameter('login_confirmation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
login_confirmation > login_required_after_signup
$user, | ||
$response); | ||
} catch (AccountStatusException $ex) { | ||
// We simply do not authenticate users which do not pass the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we should log?
'entry_options' => array( | ||
'label' => false, | ||
'choices' => array( | ||
'ROLE_ADMIN' => 'ROLE_ADMIN', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? yes?
'entry_options' => array( | ||
'label' => false, | ||
'choices' => array( | ||
'ROLE_ADMIN' => 'ROLE_ADMIN', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are your sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY review; need more testing..
PR for Issue# 5