       return "/#{entryPoint.slug}/#{route}"
     else
       return "/#{route}"
+
+  showError = (err)->
+    if err.message.length > 50
+      new KDModalView
+        title        : "Something is wrong!"
+        width        : 500
+        overlay      : yes
+        cssClass     : "new-kdmodal"
+        content      :
+          """
+            <div class='modalformline'>
+              #{err.message}
+            </div>
+          """
+    else
+      new KDNotificationView
+        title   : err.message
+        duration: 1000


      KD.remote.api.JUser.authenticateWithOauth params, (err, resp)=>
        if err
          new KDNotificationView
            title : "An error occurred: #{err.message}"
        else
          {account, replacementToken, isNewUser, userInfo} = resp
          if isNewUser

  afterLoginCallback: (err, params={})->
    @loginForm.button.hideLoader()
    {entryPoint} = KD.config
    if err
      showError err
      @loginForm.resetDecoration()
    else
      {account, replacementToken} = params
