Skip to content

Commit 7532ad0

Browse files
Changes per feedback on profile pic edit
1 parent 451f2a3 commit 7532ad0

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/ApiBundle/Controller/AuthController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,14 @@ public function editProfilePicAction()
442442

443443
$user = $this->container->get('security.context')->getToken()->getUser();
444444
if (!is_object($user) || !$user instanceof UserInterface) {
445-
$this->logAndThrowError(400, 'Invalid User', $this->get('translator')->trans('api.show_error_perm_show', array(), 'messages', $request->getLocale()), $request->getLocale());
445+
$this->logAndThrowError(400, 'Invalid User', $this->get('translator')->trans('api.show_error_perm_edit', array(), 'messages', $request->getLocale()), $request->getLocale());
446+
}
447+
448+
$file = $request->files->get('image');
449+
450+
// If no image, then exit here
451+
if ( null == $file ) {
452+
$this->logAndThrowError(400, 'No valid Image uploaded', $this->get('translator')->trans('api.show_error_image_uploaded', array(), 'messages', $request->getLocale()), $request->getLocale());
446453
}
447454

448455
// Set User data which will also return Image Validation errors, if any

src/ApiBundle/Resources/translations/messages.en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ api:
153153
show_error_password_policy: Password 6-20 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character
154154
show_error_role: Sorry! Wrong Role!
155155
show_error_image: Sorry! Some problem with image uploading!
156+
show_error_image_uploaded: Sorry! No valid image uploaded!
156157
registration_check_mail: Please check your email to complete the registration.
157158
registration_complete: Registration complete. Welcome!
158159
password_changed: Password changed successfully!
@@ -161,3 +162,4 @@ api:
161162
profile_pic_edited: Profile picture edited successfully!
162163
mail_send: Mail already send to %email%. Please check your mail.
163164
logged_in: Logged in successfully!
165+
logged_out: Logged out successfully!

src/ApiBundle/Resources/translations/messages.fr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ api:
142142
show_error_password_policy: Mot de passe 6 à 20 caractères, au moins 1 majuscule, 1 minuscule, 1 numéro et 1 caractère spécial
143143
show_error_role: Pardon! Mauvais rôle!
144144
show_error_image: Pardon! Quelque problème avec le téléchargement d'image!
145+
show_error_image_uploaded: Pardon! Aucune image valide n'a été téléchargée!
145146
registration_check_mail: Veuillez vérifier votre courriel pour compléter l'inscription.
146147
registration_complete: Inscription complète. Bienvenue!
147148
password_changed: Le mot de passe a été changé avec succès!
@@ -150,3 +151,4 @@ api:
150151
profile_pic_edited: Photo du profil éditée avec succès!
151152
mail_send: Le courrier est déjà envoyé à% email%. Veuillez vérifier votre e-mail.
152153
logged_in: Connecté avec succès!
154+
logged_out: Déconnecté avec succès!

src/ApiBundle/Resources/translations/messages.hi.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ api:
142142
show_error_password_policy: पासवर्ड 6-20 अक्षर, कम से कम 1 अपरकेस, 1 लोअरकेस, 1 संख्या और 1 विशेष अक्षर
143143
show_error_role: माफ़ कीजिये! गलत भूमिका!
144144
show_error_image: माफ़ कीजिये! छवि अपलोड करने के साथ कुछ समस्या!
145+
show_error_image_uploaded: माफ़ कीजिये! कोई मान्य छवि अपलोड!
145146
registration_check_mail: पंजीकरण पूरा करने के लिए अपने ईमेल की जाँच करें।
146147
registration_complete: पंजीकरण पूर्ण। स्वागत हे!
147148
password_changed: पासवर्ड सफलतापूर्वक बदला गया!
@@ -150,3 +151,4 @@ api:
150151
profile_pic_edited: प्रोफ़ाइल चित्र सफलतापूर्वक संपादित!
151152
mail_send: मेल पहले से ही% email% करने के लिए भेज देते हैं। कृपया अपने मेल की जाँच करें।
152153
logged_in: सफलतापूर्वक लॉग इन हो चुका है!
154+
logged_out: सफलतापूर्वक लॉग आउट!

0 commit comments

Comments
 (0)