title: SAP Hybris Assisted Service Module (ASM) - double login
body: <p>I've got a problem with ASM module - sometimes it happens that after Login action, the site is refreshed and ASM not shown.<br>
  I found that when I'm logging in, the request is sent twice at the same time. Then it leads to error with duplicated keys found in DB. I think the main problem is the double login, but I don't know what causes it.</p>
  
  <pre><code>[RQ-XXX/user-POST /custom/cs/assisted-service/login] [ip] [AssistedServiceFacade] Agent [user] has been loged in using login form
  [RQ-XXX/user-POST /custom/cs/assisted-service/login] [ip] [DefaultGUIDCookieStrategy] Setting guid cookie and session attribute: xxx
  [RQ-XXX/user-POST /custom/cs/assisted-service/login] [ip] [AssistedServiceFacade] Agent [user] has been loged in using login form
  [RQ-XXX/user-POST /custom/cs/assisted-service/login] [ip] [DefaultGUIDCookieStrategy] Setting guid cookie and session attribute: yyy
  ERROR [RQ-end] [page] Error 200 shown
   Req: null
   User:user
   Session:xxx | msg:
  java.io.IOException: Broken pipe
      at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
      at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
      at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
      at sun.nio.ch.IOUtil.write(IOUtil.java:65)
      at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:468)
  .
  .
  </code></pre>
  
  <p>This is the key error, but I'm not really sure it's the main cause of the problem.</p>
  
  <pre><code>ModelSavingException: [de.hybris.platform.servicelayer.interceptor.impl.UniqueAttributesInterceptor@2f9e23c2]:Ambiguous unique keys {key=CxActionResults_XXX} for model CxResultsModel (&lt;unsaved&gt;) –  found 1 item(s) using the same keys
  </code></pre>
  
  <p>I tried to prevent that with a .js but it didn't help:</p>
  
  <pre><code>$("#asmLoginForm").on('submit', function (e) {
     e.preventDefault();
  })
  </code></pre>
  
  <p>It doesn't happen every time.</p>