@@ -72,20 +72,14 @@ public function __construct(
72
72
public function createAdminAccessToken ($ username , $ password )
73
73
{
74
74
$ this ->validatorHelper ->validateCredentials ($ username , $ password );
75
- try {
76
- $ this ->userModel ->login ($ username , $ password );
77
- if (!$ this ->userModel ->getId ()) {
78
- /*
79
- * This message is same as one thrown in \Magento\Backend\Model\Auth to keep the behavior consistent.
80
- * Constant cannot be created in Auth Model since it uses legacy translation that doesn't support it.
81
- * Need to make sure that this is refactored once exception handling is updated in Auth Model.
82
- */
83
- throw new AuthenticationException ('Please correct the user name or password. ' );
84
- }
85
- } catch (\Magento \Backend \Model \Auth \Exception $ e ) {
86
- throw new AuthenticationException ($ e ->getMessage (), [], $ e );
87
- } catch (\Magento \Framework \Exception \LocalizedException $ e ) {
88
- throw new LocalizedException ($ e ->getMessage (), [], $ e );
75
+ $ this ->userModel ->login ($ username , $ password );
76
+ if (!$ this ->userModel ->getId ()) {
77
+ /*
78
+ * This message is same as one thrown in \Magento\Backend\Model\Auth to keep the behavior consistent.
79
+ * Constant cannot be created in Auth Model since it uses legacy translation that doesn't support it.
80
+ * Need to make sure that this is refactored once exception handling is updated in Auth Model.
81
+ */
82
+ throw new AuthenticationException ('Please correct the user name or password. ' );
89
83
}
90
84
return $ this ->tokenModelFactory ->create ()->createAdminToken ($ this ->userModel ->getId ())->getToken ();
91
85
}
0 commit comments