src/org/openbravo/erpCommon/security/Login.html
author Jonathan Bueno <jonathan.bueno@openbravo.com>
Fri, 12 Feb 2016 11:41:37 +0100
changeset 28802 25d249e69d3f
parent 28797 99dee8bbab26
child 28804 5970284b4e82
permissions -rw-r--r--
[ChangePassword] Code review applied.

Solved camel case in Days To Password Expiration column.
Labels in Login.html are now translatable.
Last Password Update column is now updated in case user didn't have a password and is set for the first time.
Messages are now set correctly from the beginning and are not overwritten.
Refactor code, now check for expiration date is made in the method, exception is thrown in the method also.
AuthenticationExpirationPasswordException now log a single line.
asier@8910
     1
<!--
asier@8910
     2
 *************************************************************************
asier@8910
     3
 * The contents of this file are subject to the Openbravo  Public  License
priya@9072
     4
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
asier@8910
     5
 * Version 1.1  with a permitted attribution clause; you may not  use this
asier@8910
     6
 * file except in compliance with the License. You  may  obtain  a copy of
asier@8910
     7
 * the License at http://www.openbravo.com/legal/license.html 
asier@8910
     8
 * Software distributed under the License  is  distributed  on  an "AS IS"
asier@8910
     9
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
asier@8910
    10
 * License for the specific  language  governing  rights  and  limitations
asier@8910
    11
 * under the License. 
asier@8910
    12
 * The Original Code is Openbravo ERP. 
asier@8910
    13
 * The Initial Developer of the Original Code is Openbravo SLU 
naroa@25597
    14
 * All portions are Copyright (C) 2010-2015 Openbravo SLU 
asier@8910
    15
 * All Rights Reserved. 
asier@8910
    16
 * Contributor(s):  ______________________________________.
asier@8910
    17
 ************************************************************************
asier@8910
    18
-->
asier@8910
    19
david@8918
    20
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
david@8918
    21
<head>
asier@8910
    22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
asier@8910
    23
<title>Openbravo</title>
asier@8910
    24
<link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" id="favicon" />
asier@8910
    25
<link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS" />
david@8918
    26
<script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
asier@8910
    27
<script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
david@8931
    28
<script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
asier@8920
    29
<script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
asier@8920
    30
<script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
asier@8923
    31
<script language="JavaScript" src="../utility/CheckCleanCache.js?cache=true" type="text/javascript"></script>
asier@8923
    32
<script language="JavaScript" src="../utility/CheckCleanCache.js?cache=false" type="text/javascript"></script>
david@8941
    33
<script language="JavaScript" type="text/javascript" id="visualPrefs">var showCompanyLogo = true, showSupportLogo = true, showForgeLogo = true, urlCompany = 'http://www.openbravo.com/', urlSupport = 'http://support.openbravo.com/';/* Parameters retreived from Login.java */</script>
david@8939
    34
<script language="JavaScript" type="text/javascript">var urlForge = 'http://forge.openbravo.com/';</script>
asier@14340
    35
<script language="JavaScript" type="text/javascript" id="expirationMessage"></script>
david@8931
    36
<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = 'xx';</script>
david@10246
    37
<script language="JavaScript" type="text/javascript" id="validBrowserMsg">var validBrowserMsg = 'xx';</script>
david@10269
    38
<script language="JavaScript" type="text/javascript" id="validBrowserMsgOrHigher">var validBrowserMsgOrHigher = 'xx';</script>
david@10246
    39
<script language="JavaScript" type="text/javascript" id="recBrowserMsgTitle">var recBrowserMsgTitle = 'xx';</script>
david@10246
    40
<script language="JavaScript" type="text/javascript" id="recBrowserMsgText">var recBrowserMsgText = 'xx';</script>
augusto@14219
    41
<script language="JavaScript" type="text/javascript" id="identificationFailureTitle">var identificationFailureTitle = 'xx';</script>
augusto@14219
    42
<script language="JavaScript" type="text/javascript" id="errorEmptyContent">var errorEmptyContent = 'xx';</script>
asier@8923
    43
david@10269
    44
<script language="JavaScript" type="text/javascript">
david@27856
    45
var validBrowserFirefox = '38.0.0.0';
david@28481
    46
var validBrowserChrome = '46.0.0.0';
david@26264
    47
var validBrowserExplorer = '9.0.0.0';
david@28481
    48
var validBrowserSafari = '8.0.0.0';
david@10269
    49
david@27171
    50
var recBrowserFirefox = '38.0.0.0';
david@28481
    51
var recBrowserChrome = '47.0.0.0';
david@25757
    52
var recBrowserExplorer = '11.0.0.0';
david@28481
    53
var recBrowserSafari = '9.0.0.0';
david@10269
    54
</script>
david@10269
    55
asier@8910
    56
<script type="text/javascript">
asier@8910
    57
  function redirectWhenPopup() {
asier@8910
    58
    var permission = false;
asier@8910
    59
    try {
asier@8910
    60
      if (top.opener.parent.frames['appFrame']) {
asier@8910
    61
        permission = true;
asier@8910
    62
      }
asier@8910
    63
    }
asier@8910
    64
    catch (e) {}
asier@8910
    65
    if (permission && top.opener) {
asier@8910
    66
      top.opener.parent.location.href = top.document.location.href;
asier@8910
    67
      top.window.close();
asier@8910
    68
    }
asier@8910
    69
  }
asier@8910
    70
asier@8910
    71
  function redirectWhenInsideMDI() {
asier@8910
    72
    if (typeof isWindowInMDIPage !== 'undefined' && isWindowInMDIPage) {
david@8918
    73
      var LayoutMDI = null;
david@8918
    74
      if (isWindowInMDIPopup && parent.opener) {
david@8918
    75
        LayoutMDI = parent.opener.getFrame('LayoutMDI'); // Since getFrame('LayoutMDI') function frameset checks equals the current opened Login_FS.html modal popup
david@8918
    76
      } else {
david@8918
    77
        LayoutMDI = getFrame('LayoutMDI');
david@8918
    78
      }
asier@8910
    79
      if (LayoutMDI && typeof parent.document.getElementById('framesetMenu') === 'object') {
asier@8910
    80
        LayoutMDI.location.href = parent.window.location.href;
asier@8910
    81
      }
asier@8910
    82
    }
asier@8910
    83
  }
asier@8910
    84
asier@8910
    85
  function hideMenuFrame() {
asier@8910
    86
    if (parent.document.getElementById('framesetMenu')) {
asier@8910
    87
      parent.document.getElementById('framesetMenu').cols = parent.document.getElementById('framesetMenu').cols.replace(parent.menuWidth, '0%');
david@20834
    88
      if (navigator.userAgent.indexOf('Trident/6.0') !== -1) {
david@20834
    89
        // There is an issue with IE10 while resizing frameset columns or rows:
david@20834
    90
        // https://connect.microsoft.com/IE/feedback/details/776054/cannot-resize-frameset-columns-or-rows-with-javascript
david@20834
    91
        // The solution is do a dummy style change to force window re-rendering
david@20834
    92
        parent.document.getElementById('framesetMenu').style.backgroundColor = 'white';
david@20834
    93
      }
asier@8910
    94
    }
asier@8910
    95
  }
david@8918
    96
</script>
david@8918
    97
<script type="text/javascript">
david@8958
    98
  function setLoginMessage(type, title, text) {
david@8931
    99
    if (type === 'Error') {
david@8918
   100
      var msgContainer = document.getElementById('errorMsg');
david@8958
   101
      var msgContainerTitle = document.getElementById('errorMsgTitle');
david@13393
   102
      var msgContainerTitleContainer = document.getElementById('errorMsgTitle_Container');
david@8958
   103
      var msgContainerContent = document.getElementById('errorMsgContent');
david@8958
   104
      if (typeof title !== 'undefined' && title !== '' && title !== null) {
david@8958
   105
        msgContainerTitle.innerHTML = title.replace(/\n/g, '<br>').replace(/\\n/g, '<br>');
david@13393
   106
        msgContainerTitleContainer.style.display = '';
david@8958
   107
      } else {
david@8958
   108
        msgContainerTitle.innerHTML = '';
david@13393
   109
        msgContainerTitleContainer.style.display = 'none';
david@8958
   110
      }
david@8958
   111
      if (typeof text !== 'undefined' && text !== '' && text !== null) {
david@8958
   112
        msgContainerContent.innerHTML = text.replace(/\n/g, '<br>').replace(/\\n/g, '<br>');
david@8958
   113
      } else {
david@8958
   114
        msgContainerContent.innerHTML = '';
david@8958
   115
      }
david@8931
   116
      msgContainer.style.display = '';
david@10269
   117
      isRecBrowserMsgShown = false;
asier@16643
   118
      return false;
asier@16643
   119
    } else if (type === 'Warning' || type === 'Confirmation') {
david@8958
   120
      var alertText = '';
david@8958
   121
      if (typeof title !== 'undefined' && title !== '' && title !== null) {
david@8958
   122
        alertText += title.replace(/<br>/g, '\n') + '\n';
david@8958
   123
      }
david@8958
   124
      if (typeof text !== 'undefined' && text !== '' && text !== null) {
david@8958
   125
        alertText += text.replace(/<br>/g, '\n')
david@8958
   126
      }
asier@16643
   127
      if (type === 'Warning') {
asier@16643
   128
        alert(alertText);
asier@16643
   129
        return true;
asier@16643
   130
      } else {
asier@16643
   131
        return confirm(alertText);
asier@16643
   132
      }
asier@8910
   133
    }
asier@8910
   134
  }
asier@8921
   135
david@10269
   136
  var isRecBrowserMsgShown = false;
david@10246
   137
  function setRecommendedBrowserMessage(title, text) {
david@10246
   138
    var msgContainer = document.getElementById('errorMsg');
david@10246
   139
    var msgContainerTitle = document.getElementById('errorMsgTitle');
david@10246
   140
    var msgContainerContent = document.getElementById('errorMsgContent');
david@10246
   141
    msgContainerTitle.innerHTML = '';
david@10246
   142
    if (typeof title !== 'undefined' && title !== '' && title !== null) {
david@10246
   143
      msgContainerContent.innerHTML = '<span class="Login_RecBrowserMsg_Title">' + title.replace(/\n/g, '<br>').replace(/\\n/g, '<br>') + ': ' + '</span>';
david@10246
   144
    } else {
david@10246
   145
      msgContainerContent.innerHTML = '';
david@10246
   146
    }
david@10246
   147
    if (typeof text !== 'undefined' && text !== '' && text !== null) {
david@10246
   148
      msgContainerContent.innerHTML = msgContainerContent.innerHTML + '<span class="Login_RecBrowserMsg_Content">' + text.replace(/\n/g, '<br>').replace(/\\n/g, '<br>') + '</span>';
david@10246
   149
    }
david@10246
   150
    msgContainer.style.display = '';
david@10269
   151
    isRecBrowserMsgShown = true;
david@10246
   152
  }
david@10246
   153
david@8973
   154
  function resetLoginMessage() {
asier@8921
   155
    var msgContainer = document.getElementById('errorMsg');
david@8958
   156
    var msgContainerTitle = document.getElementById('errorMsgTitle');
david@13393
   157
    var msgContainerTitleContainer = document.getElementById('errorMsgTitle_Container');
david@8958
   158
    var msgContainerContent = document.getElementById('errorMsgContent');
david@8958
   159
    msgContainerTitle.innerHTML = '';
david@13393
   160
    msgContainerTitleContainer.style.display = '';
david@8958
   161
    msgContainerContent.innerHTML = '';
david@8931
   162
    msgContainer.style.display = 'none';
david@10269
   163
    isRecBrowserMsgShown = false;
asier@8921
   164
  }
david@8973
   165
david@8973
   166
  function addInputChangeCheck(input) {
david@8973
   167
    setObjAttribute(input, 'onkeypress', 'checkInputKeyDown(this); return true;');
david@8973
   168
    setObjAttribute(input, 'oncut', 'checkInputKeyDown(this); return true;');
david@8973
   169
    setObjAttribute(input, 'oncopy', 'checkInputKeyDown(this); return true;');
david@8973
   170
    setObjAttribute(input, 'onpaste', 'checkInputKeyDown(this); return true;');
david@8973
   171
  }
david@8973
   172
david@8973
   173
  function checkInputKeyDown(input, valueLength) {
david@8973
   174
    var msgContainer = document.getElementById('errorMsg');
david@10269
   175
    if (msgContainer.style.display !== 'none' && typeof input === 'object') {
david@10269
   176
      if (typeof valueLength === 'undefined' || valueLength === null) {
david@8973
   177
        valueLength = input.value.length;
david@8973
   178
        setTimeout(function() { checkInputKeyDown(input, valueLength); }, 100);
david@8973
   179
      } else {
david@10269
   180
        if (valueLength !== input.value.length && !isRecBrowserMsgShown) {
david@8973
   181
          resetLoginMessage();
david@8973
   182
        }
david@8973
   183
      }
david@8973
   184
    }
david@8973
   185
    return true;
david@8973
   186
  }
david@8918
   187
</script>
david@8918
   188
<script type="text/javascript">
augusto@14219
   189
function buttonOK_click() {
jonathan@28772
   190
    if (document.getElementById('resetPassword').value =='true' && document.getElementById('user').value !== document.getElementById('password').value){
jonathan@28771
   191
        setLoginMessage('Error', "Passwords must be the same", "The password must be the same in both fields");
jonathan@28771
   192
        return true;
jonathan@28771
   193
    }
augusto@14219
   194
    if (focusedWindowElement.id === 'user' && document.getElementById('user').value !== '' && document.getElementById('password').value === '') {
david@8937
   195
      setTimeout(function() { // To manage browser autocomplete feature if it is active
david@8939
   196
       if (focusedWindowElement.id === 'user' && document.getElementById('password').value === '') {
david@8934
   197
         setWindowElementFocus(document.getElementById('password')) 
david@8934
   198
       } else {
david@8934
   199
         return true;
david@8934
   200
       }
david@8934
   201
      }, 10);
augusto@14219
   202
    } else if (focusedWindowElement.id === 'password' && document.getElementById('password').value !== '' && document.getElementById('user').value === '') {
david@8934
   203
      setWindowElementFocus(document.getElementById('user'))
david@8934
   204
    } else {
augusto@14219
   205
      if (document.getElementById('user').value === '' || document.getElementById('password').value === '') {
augusto@14219
   206
          setLoginMessage('Error', identificationFailureTitle, errorEmptyContent);
augusto@14219
   207
        return true;
jonathan@28771
   208
      }   
david@8934
   209
      disableButton('buttonOK');
david@8934
   210
      submitXmlHttpRequest(loginResult, document.frmIdentificacion, 'DEFAULT', '../secureApp/LoginHandler.html', false, null, null);
david@8934
   211
    }
jonathan@28771
   212
    
david@8918
   213
    return false;
david@8918
   214
  }
asier@8919
   215
asier@8919
   216
  function loginResult(paramXMLParticular, XMLHttpRequestObj) {
david@8931
   217
     var strText = '';
david@8931
   218
     if (getReadyStateHandler(XMLHttpRequestObj, null, false)) {
asier@8919
   219
       if (XMLHttpRequestObj.responseText) {
asier@8919
   220
         strText = XMLHttpRequestObj.responseText;
asier@8919
   221
       }
asier@8919
   222
       strText = strText.toString();
david@8931
   223
       var result = eval('('+strText+')');
asier@8919
   224
       processResult(result);
asier@8919
   225
     }
asier@8919
   226
  }
asier@8919
   227
asier@8919
   228
  function processResult(result){
asier@16643
   229
    var target, command, shouldContinue = true;
asier@8919
   230
    if (result.showMessage) {
asier@16643
   231
      shouldContinue = setLoginMessage(result.messageType, result.messageTitle, result.messageText);
asier@16653
   232
      if (!shouldContinue) {
asier@16653
   233
        document.getElementById('password').value = '';
asier@16653
   234
      }
asier@8919
   235
    }
jonathan@28772
   236
    if (result.resetPassword && document.getElementById('loggedUser').value===''){
jonathan@28781
   237
      document.getElementById('loggedUser').value=result.loggedUser;
jonathan@28781
   238
      document.getElementById('resetPassword').value=result.resetPassword;
jonathan@28781
   239
      document.getElementById('user').value = '';
jonathan@28781
   240
      document.getElementById('user').type = 'password';
jonathan@28802
   241
      document.getElementById('userlabel').style.display = 'none';
jonathan@28802
   242
      document.getElementById('passwordlabel').style.display = 'none';
jonathan@28802
   243
      document.getElementById('newpasswordlabel').style.display = '';
jonathan@28802
   244
      document.getElementById('confirmpasswordlabel').style.display = '';
jonathan@28771
   245
    }
asier@16643
   246
    if (shouldContinue) {
asier@8936
   247
      try {
asier@8936
   248
        if (parent.frameMenu) {
asier@8936
   249
          target = '_parent';
asier@8936
   250
        } else {
asier@8936
   251
          target = '_self';
asier@8936
   252
        }
asier@8936
   253
      } catch (e) {
asier@8936
   254
        target = '_self';
david@8931
   255
      }
asier@16643
   256
      command = result.command || 'DEFAULT';
asier@16643
   257
      submitCommandForm(command, false, null, result.target, target, true);
jonathan@28781
   258
    }else if (result.resetPassword){
jonathan@28781
   259
      enableButton('buttonOK');
jonathan@28797
   260
      document.getElementById('user').value = '';
jonathan@28781
   261
      setWindowElementFocus('user', 'id');
asier@8923
   262
    } else {
david@8931
   263
      enableButton('buttonOK');
david@8966
   264
      setWindowElementFocus('password', 'id');
asier@8923
   265
    }
asier@8919
   266
  }
david@8918
   267
</script>
david@8918
   268
<script type="text/javascript">
david@8937
   269
  function manageVisualPreferences() {
david@10723
   270
    var topLogos = document.getElementById('TopLogos_Container');
david@8937
   271
    var bottomLogos = document.getElementById('BottomLogos_Container');
david@8939
   272
    if (showSupportLogo && showForgeLogo) {
david@10723
   273
      topLogos.className = 'Login_TopLogos_Container_Support_Forge';
david@8937
   274
    } else if (showSupportLogo) {
david@10723
   275
      topLogos.className = 'Login_TopLogos_Container_Support';
david@8939
   276
    } else if (showForgeLogo) {
david@10723
   277
      topLogos.className = 'Login_TopLogos_Container_Forge';
david@8937
   278
    } else {
david@10723
   279
      topLogos.className = 'Login_TopLogos_Container_None';
david@8937
   280
    }
david@8937
   281
david@8939
   282
    if (showCompanyLogo && urlCompany !== '') {
david@8971
   283
      document.getElementById('CompanyLogo_Container').innerHTML = '<a href="' + urlCompany + '" target="_blank" class="Login_Img_Link">' + document.getElementById('CompanyLogo_Container').innerHTML + '</a>';
david@8937
   284
    }
david@8937
   285
david@8939
   286
    if (showSupportLogo && urlSupport !== '') {
david@8971
   287
      document.getElementById('SupportLogo_Container').innerHTML = '<a href="' + urlSupport + '" target="_blank" class="Login_Img_Link">' + document.getElementById('SupportLogo_Container').innerHTML + '</a>';
david@8937
   288
    }
david@8937
   289
david@8939
   290
    if (showForgeLogo && urlForge !== '') {
david@8971
   291
      document.getElementById('ForgeLogo_Container').innerHTML = '<a href="' + urlForge + '" target="_blank" class="Login_Img_Link">' + document.getElementById('ForgeLogo_Container').innerHTML + '</a>';
david@8937
   292
    }
david@8937
   293
david@8937
   294
    if (showCompanyLogo) {
david@8939
   295
      document.getElementById('CompanyLogo_Container').style.display = ''
david@8937
   296
    }
david@10723
   297
    topLogos.style.display = '';
david@8939
   298
    bottomLogos.style.display = '';
david@8937
   299
  }
david@9005
   300
david@9005
   301
  function maskLoginWindow(errorMsg) {
david@9005
   302
    var client = document.getElementById('client');
david@9005
   303
    var blocker = document.getElementById('blocker');
david@9005
   304
    blocker.innerHTML = '<div class="Login_Home_Logo_Icon" style="position: relative; padding: 50px 0px 0px 0px; margin: 0 auto;"></div><div class="LabelText" style="position: relative; text-align: center; color: red; font-size: 11pt; padding: 10px 0px 0px 0px; width: 608px; margin: 0 auto;">' + errorMsg + '</div>';
david@9005
   305
    blocker.style.display = '';
david@9005
   306
    client.style.display = 'none';
david@9005
   307
  }
david@8937
   308
</script>
david@8937
   309
<script type="text/javascript">
david@10269
   310
  function browserVersionToFloat(versionNum) {
david@10269
   311
    while (versionNum.indexOf('.') !== versionNum.lastIndexOf('.')) {
david@10269
   312
      versionNum = versionNum.substring(0, versionNum.lastIndexOf('.')) + versionNum.substring(versionNum.lastIndexOf('.')+1, versionNum.length);
david@10269
   313
    }
david@10269
   314
    versionNum = parseFloat(versionNum, 10);
david@10269
   315
    return versionNum;
david@10269
   316
  }
david@10269
   317
david@10269
   318
  function browserVersionTrim(versionNum) {
david@12919
   319
    while ((versionNum.substring(versionNum.length-1, versionNum.length) === '0' && versionNum.indexOf('.') !== -1) || versionNum.substring(versionNum.length-1, versionNum.length) === '.') {
david@12919
   320
      versionNum = versionNum.substring(0, versionNum.length-1);
david@10269
   321
    }
david@10269
   322
    return versionNum;
david@10269
   323
  }
david@10269
   324
david@10269
   325
  /**
david@10269
   326
  * Checks if the browser is a supported one. Just for 2.50
david@10269
   327
  */
david@10269
   328
  function checkBrowserCompatibility() {
david@10269
   329
    var browserName = getBrowserInfo('name');
david@10269
   330
    var browserVersion = getBrowserInfo('version');
david@10269
   331
    var browserMajorVersion = getBrowserInfo('majorVersion');
david@10269
   332
    var isValid = false;
david@10269
   333
    if (browserName.toUpperCase().indexOf('FIREFOX') != -1 || browserName.toUpperCase().indexOf('ICEWEASEL') != -1) {
david@10269
   334
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(validBrowserFirefox)) {
david@10269
   335
        isValid = true;
david@10269
   336
      }
david@10269
   337
    } else if (browserName.toUpperCase().indexOf('INTERNET EXPLORER') != -1) {
david@10269
   338
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(validBrowserExplorer)) {
david@10269
   339
        isValid = true;
david@10269
   340
      }
david@10269
   341
    } else if (browserName.toUpperCase().indexOf('GOOGLE CHROME') != -1) {
david@10269
   342
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(validBrowserChrome)) {
david@10269
   343
        isValid = true;
david@10269
   344
      }
david@10269
   345
    } else if (browserName.toUpperCase().indexOf('APPLE SAFARI') != -1) {
david@10269
   346
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(validBrowserSafari)) {
david@10269
   347
        isValid = true;
david@10269
   348
      }
david@10269
   349
    }
david@10269
   350
    return isValid;
david@10269
   351
  }
david@10269
   352
david@10269
   353
  /**
david@10269
   354
  * Checks if the browser is a recommended one
david@10269
   355
  */
david@10269
   356
  function checkRecommendedBrowser() {
david@10269
   357
    var browserName = getBrowserInfo('name');
david@10269
   358
    var browserVersion = getBrowserInfo('version');
david@10269
   359
    var browserMajorVersion = getBrowserInfo('majorVersion');
david@10269
   360
    var isRecommended = false;
david@10269
   361
    if (browserName.toUpperCase().indexOf('FIREFOX') != -1 || browserName.toUpperCase().indexOf('ICEWEASEL') != -1) {
david@10269
   362
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(recBrowserFirefox)) {
david@10269
   363
        isRecommended = true;
david@10269
   364
      }
david@10269
   365
    } else if (browserName.toUpperCase().indexOf('INTERNET EXPLORER') != -1) {
david@10269
   366
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(recBrowserExplorer)) {
david@10269
   367
        isRecommended = true;
david@10269
   368
      }
david@10269
   369
    } else if (browserName.toUpperCase().indexOf('GOOGLE CHROME') != -1) {
david@10269
   370
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(recBrowserChrome)) {
david@10269
   371
        isRecommended = true;
david@10269
   372
      }
david@12918
   373
    } else if (browserName.toUpperCase().indexOf('APPLE SAFARI') != -1) {
david@12918
   374
      if (browserVersionToFloat(browserVersion) >= browserVersionToFloat(recBrowserSafari)) {
david@12918
   375
        isRecommended = true;
david@12918
   376
      }
david@10269
   377
    }
david@10269
   378
    return isRecommended;
david@10269
   379
  }
david@10269
   380
david@10269
   381
  function buildValidBrowserMsg() {
david@10269
   382
    var displayValidBrowserMsg = validBrowserMsg;
david@10269
   383
    displayValidBrowserMsg = displayValidBrowserMsg
david@10269
   384
      + '<br>' + ' * Mozilla Firefox ' + browserVersionTrim(validBrowserFirefox) + ' ' + validBrowserMsgOrHigher
david@10269
   385
      + '<br>' + ' * Google Chrome ' + browserVersionTrim(validBrowserChrome) + ' ' + validBrowserMsgOrHigher
david@10269
   386
      + '<br>' + ' * Microsoft Internet Explorer ' + browserVersionTrim(validBrowserExplorer) + ' ' + validBrowserMsgOrHigher
david@10269
   387
      + '<br>' + ' * Apple Safari ' + browserVersionTrim(validBrowserSafari) + ' ' + validBrowserMsgOrHigher;
david@10269
   388
    return displayValidBrowserMsg;
david@10269
   389
  }
david@10269
   390
david@10269
   391
  function buildRecBrowserMsgText() {
david@10269
   392
    var displayRecBrowserMsgText = recBrowserMsgText;
david@12918
   393
    displayRecBrowserMsgText = displayRecBrowserMsgText.replace('XX', 'Google Chrome ' + browserVersionTrim(recBrowserChrome) + ', Mozilla Firefox ' + browserVersionTrim(recBrowserFirefox) + ', Internet Explorer ' + browserVersionTrim(recBrowserExplorer));
david@12918
   394
    displayRecBrowserMsgText = displayRecBrowserMsgText.replace('YY', 'Apple Safari ' + browserVersionTrim(recBrowserSafari) + '');
david@10269
   395
    return displayRecBrowserMsgText;
david@10269
   396
  }
david@10269
   397
</script>
david@10269
   398
<script type="text/javascript">
asier@8910
   399
  function beforeLoadDo() {
asier@8910
   400
    redirectWhenPopup();
asier@8910
   401
    redirectWhenInsideMDI();
asier@8910
   402
    hideMenuFrame();
asier@8910
   403
  }
asier@8910
   404
asier@8910
   405
  function onLoadDo() {
david@13393
   406
    var msgContainer = document.getElementById('errorMsg');
david@13393
   407
    var msgContainerTitle = document.getElementById('errorMsgTitle');
david@13393
   408
    var msgContainerTitleContainer = document.getElementById('errorMsgTitle_Container');
david@13393
   409
    var msgContainerContent = document.getElementById('errorMsgContent');
david@13393
   410
david@13393
   411
    if (msgContainerTitle.innerHTML.length === 0) {
david@13393
   412
      msgContainerTitleContainer.style.display = 'none';
david@13393
   413
    }
david@9002
   414
    try { // To avoid in a release upgrade, that a change in code depending on these functions cause revisionControl message not being displayed
david@9002
   415
      manageVisualPreferences();
david@9002
   416
      addInputChangeCheck(document.getElementById('user'));
david@9002
   417
      addInputChangeCheck(document.getElementById('password'));
david@9002
   418
      this.windowTables = new Array(
david@9002
   419
        new windowTableId('client', 'buttonOK')
david@9002
   420
      );
david@9002
   421
      setWindowTableParentElement();
david@9002
   422
      enableShortcuts('edition');
david@9002
   423
      setWindowElementFocus('user', 'id');
david@9002
   424
    }
david@9002
   425
    catch (e) { }
asier@8923
   426
carlos@28336
   427
    if ((!revisionControl('28036')) || (isOpsInstance() != isOpsInstanceCached())) {
david@9005
   428
      maskLoginWindow(cacheMsg);
david@8958
   429
      setLoginMessage('Warning', '', cacheMsg);
asier@8923
   430
    }
asier@8923
   431
asier@8923
   432
    if (!checkBrowserCompatibility()) {
david@10269
   433
      var displayValidBrowserMsg = buildValidBrowserMsg();
david@10269
   434
      setLoginMessage('Warning', '', displayValidBrowserMsg);
david@10246
   435
    }
david@13393
   436
    if (!checkRecommendedBrowser() && msgContainerTitle.innerHTML.length === 0 && msgContainerContent.innerHTML.length === 0) {
david@10269
   437
      var displayRecBrowserMsgText = buildRecBrowserMsgText();
david@10269
   438
      setRecommendedBrowserMessage(recBrowserMsgTitle, displayRecBrowserMsgText);
asier@8923
   439
    }
asier@14340
   440
    
asier@14340
   441
    if (expirationMessage){
asier@14340
   442
      setLoginMessage(expirationMessage.type, expirationMessage.title, expirationMessage.text);
asier@14340
   443
      if (expirationMessage.disableLogin) {
asier@14340
   444
          disableButton('buttonOK');
asier@14343
   445
          document.frmIdentificacion.user.disabled = true;
asier@14343
   446
          document.frmIdentificacion.password.disabled = true;
asier@14340
   447
      }
asier@14340
   448
    }
asier@8910
   449
  }
asier@8910
   450
</script>
david@8918
   451
<script type="text/javascript">
david@8918
   452
  beforeLoadDo();
david@8918
   453
</script>
asier@8910
   454
</head>
david@8918
   455
<body onload="onLoadDo();">
david@9005
   456
  <div style="display: none; width: 100%; height: 100%; position: absolute; vertical-align: middle; padding: 0px; text-align: center;" id="blocker"></div>
asier@8910
   457
david@8918
   458
  <div class="Login_Main" id="client">
asier@8910
   459
david@8937
   460
    <div class="Login_Container">
asier@8910
   461
david@8937
   462
      <div class="Login_LogForm">
david@8918
   463
        <form method="post" action="../secureApp/LoginHandler.html" name="frmIdentificacion" id="frmFormulario" autocomplete="off">
david@14041
   464
          <input type="hidden" name="Command" value="" />
jonathan@28771
   465
          <input type="hidden" name="loggedUser" id="loggedUser" value="" />
jonathan@28771
   466
          <input type="hidden" name="resetPassword" id="resetPassword" value="" />
david@14041
   467
          <div class="Login_LogForm_CompanyLogo_Container">
david@14041
   468
            <div class="Login_LogForm_CompanyLogo" id="CompanyLogo_Container" style="display: none;"><img class="Login_Logo_Company" src="../../../../../web/images/blank.gif" /></div>
david@14041
   469
          </div>
david@14041
   470
          <div class="Login_LogForm_Input_Container">
david@14041
   471
            <dl>
david@14041
   472
              <dt>
jonathan@28771
   473
                <label for="user" class="LabelText Login_LabelText" id="userlabel" >User Name</label>
david@14041
   474
              </dt>
jonathan@28802
   475
              <dt>
jonathan@28802
   476
                <label for="user" class="LabelText Login_LabelText" id="newpasswordlabel" style="display:none;">New Password</label>
jonathan@28802
   477
              </dt>
david@14041
   478
              <dd>
david@14041
   479
                <input class="dojoValidateValid Login_TextBox" type="text" maxlength="60" name="user" id="user" />
david@14041
   480
              </dd>
david@14041
   481
              <dt>
jonathan@28771
   482
                <label for="password" class="LabelText Login_LabelText" id="passwordlabel" >Password</label>
david@14041
   483
              </dt>
jonathan@28802
   484
              <dt>
jonathan@28802
   485
                <label for="password" class="LabelText Login_LabelText" id="confirmpasswordlabel" style="display:none;">Confirm Password</label>
jonathan@28802
   486
              </dt>
david@14041
   487
              <dd>
david@14041
   488
                <input class="dojoValidateValid Login_TextBox" type="password" maxlength="40" name="password" id="password" />
david@14041
   489
              </dd>
david@14041
   490
            </dl>
david@14041
   491
            <div id="errorMsg" class="LabelText Login_ErrorMsg_Container" style="display:none;">
david@14041
   492
              <span id="errorMsgTitle_Container"><span id="errorMsgTitle" class="Login_ErrorMsg_Title">xx</span><br></span><span id="errorMsgContent" class="Login_ErrorMsg_Content">xx</span>
david@8918
   493
            </div>
david@14041
   494
          </div>
david@14041
   495
        </form>
david@14041
   496
        <div class="Login_LogForm_Button_Container">
david@14041
   497
          <div class="Login_LogForm_Button">
david@14041
   498
            <button type="button" 
david@14041
   499
              id="buttonOK" 
david@14041
   500
              class="ButtonLink" 
david@14041
   501
              onclick="buttonOK_click();" 
david@14041
   502
              onfocus="buttonEvent('onfocus', this); window.status='Login'; return true;" 
david@14041
   503
              onblur="buttonEvent('onblur', this);" 
david@14041
   504
              onkeyup="buttonEvent('onkeyup', this);" 
david@14041
   505
              onkeydown="buttonEvent('onkeydown', this);" 
david@14041
   506
              onkeypress="buttonEvent('onkeypress', this);" 
david@14041
   507
              onmouseup="buttonEvent('onmouseup', this);" 
david@14041
   508
              onmousedown="buttonEvent('onmousedown', this);" 
david@14041
   509
              onmouseover="buttonEvent('onmouseover', this); window.status='Login'; return true;" 
david@14041
   510
              onmouseout="buttonEvent('onmouseout', this);">
david@14041
   511
              <table class="Button" id="fieldTable">
david@14041
   512
                <tr>
david@14041
   513
                  <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Login" title="Login" src="../../../../../web/images/blank.gif" border="0" id="fieldButton" /></td>
david@14041
   514
                  <td class="Button_text Button_width">Log in</td>
david@14041
   515
                  <td class="Button_right"></td>
david@14041
   516
                </tr>
david@14041
   517
              </table>
david@14041
   518
            </button>
david@14041
   519
          </div>
david@14041
   520
          <div id="sign-in" style="margin-top:12px;">xxxSignIn</div>
david@14041
   521
        </div>
david@8918
   522
david@8918
   523
      </div>
david@10723
   524
david@10723
   525
      <div class="Login_TopLogos_Container_Support_Forge" id="TopLogos_Container" style="display: none;">
david@10723
   526
        <div style="height: 1px; width: 1px; font-size: 1"></div>
david@10723
   527
        <div class="Login_TopLogos_ForgeLogo_Container">
david@10723
   528
          <div class="LabelText Login_LabelText Login_TopLogos_ForgeLogo_Text">Project hosted at:</div>
david@10723
   529
          <div class="Login_TopLogos_ForgeLogo_Logo_Container" id="ForgeLogo_Container"><img class="Login_Logo_Forge" src="../../../../../web/images/blank.gif" /></div>
asier@8910
   530
        </div>
david@10723
   531
        <div class="Login_TopLogos_SupportLogo_Container">
david@10723
   532
          <div class="LabelText Login_LabelText Login_TopLogos_SupportLogo_Text">For support, contact:</div>
david@10723
   533
          <div class="Login_TopLogos_SupportLogo_Logo_Container" id="SupportLogo_Container"><img class="Login_Logo_Support" src="../../../../../web/images/blank.gif" /></div>
david@10723
   534
        </div>
david@8918
   535
      </div>
david@8918
   536
david@10723
   537
      <div class="Login_BottomLogos_Container" id="BottomLogos_Container" style="display: none;">
david@10723
   538
        <div class="Login_BottomLogos_Openbravo_Logo_Container" id="OpenbravoLogo_Container"><img class="Login_Logo_Openbravo" src="../../../../../web/images/blank.gif" /></div>
david@10723
   539
        <div class="Login_BottomLogos_CopyrightText_Container"><span class="Login_BottomLogos_CopyrightText">&copy; Copyright Openbravo <br />
naroa@28137
   540
        2001-2016</span></div>
david@8918
   541
      </div>
david@8918
   542
    </div>
asier@8910
   543
david@8918
   544
  </div>
asier@8910
   545
david@8918
   546
</body>
david@8918
   547
</html>