File tree 1 file changed +9
-3
lines changed
src/main/java/com/appirio/tech/core/service/identity/resource
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -767,12 +767,18 @@ public ApiResponse login(
767
767
@ Timed
768
768
public ApiResponse roles (
769
769
@ FormParam ("email" ) String email ,
770
+ @ FormParam ("handle" ) String handle ,
770
771
@ Context HttpServletRequest request ) throws Exception {
771
772
772
- if (Utils .isEmpty (email ))
773
- throw new APIRuntimeException (SC_BAD_REQUEST , String .format (MSG_TEMPLATE_MANDATORY , "email" ));
773
+ if (Utils .isEmpty (email ) && Utils . isEmpty ( handle ) )
774
+ throw new APIRuntimeException (SC_BAD_REQUEST , String .format (MSG_TEMPLATE_MANDATORY , "email/handle " ));
774
775
775
- User user = userDao .findUserByEmail (email );
776
+ User user = null ;
777
+ if (!Utils .isEmpty (handle )) {
778
+ user = userDao .findUserByHandle (handle );
779
+ } else {
780
+ user = userDao .findUserByEmail (email );
781
+ }
776
782
777
783
if (user ==null ) {
778
784
throw new APIRuntimeException (SC_UNAUTHORIZED , "Credentials are incorrect." );
You can’t perform that action at this time.
0 commit comments