src-db/database/model/triggers/AD_USER_EXPIRYPASS_TRG.xml
author Jonathan Bueno <jonathan.bueno@openbravo.com>
Fri, 12 Feb 2016 11:41:37 +0100
changeset 28802 25d249e69d3f
parent 28800 75cb35d38d02
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.
jonathan@28772
     1
<?xml version="1.0"?>
jonathan@28772
     2
  <database name="TRIGGER AD_USER_EXPIRYPASS_TRG">
jonathan@28795
     3
    <trigger name="AD_USER_EXPIRYPASS_TRG" table="AD_USER" fires="before" insert="false" update="true" delete="false" foreach="row">
jonathan@28772
     4
      <body><![CDATA[
jonathan@28776
     5
      
jonathan@28776
     6
/*************************************************************************
jonathan@28776
     7
* The contents of this file are subject to the Openbravo  Public  License
jonathan@28776
     8
* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
jonathan@28776
     9
* Version 1.1  with a permitted attribution clause; you may not  use this
jonathan@28776
    10
* file except in compliance with the License. You  may  obtain  a copy of
jonathan@28776
    11
* the License at http://www.openbravo.com/legal/license.html
jonathan@28776
    12
* Software distributed under the License  is  distributed  on  an "AS IS"
jonathan@28776
    13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
jonathan@28776
    14
* License for the specific  language  governing  rights  and  limitations
jonathan@28776
    15
* under the License.
jonathan@28776
    16
* The Original Code is Openbravo ERP.
jonathan@28776
    17
* The Initial Developer of the Original Code is Openbravo SLU
jonathan@28777
    18
* All portions are Copyright (C) 2015 Openbravo SLU
jonathan@28776
    19
* All Rights Reserved.
jonathan@28791
    20
* Contributor(s):  ______________________________________.
jonathan@28776
    21
************************************************************************/
jonathan@28772
    22
 
jonathan@28772
    23
 BEGIN
jonathan@28772
    24
 
jonathan@28791
    25
   IF AD_isTriggerEnabled()='N' THEN RETURN;
jonathan@28772
    26
   END IF;
jonathan@28772
    27
jonathan@28802
    28
   IF (:OLD.password<>:NEW.password OR :OLD.password IS NULL AND :NEW.password IS NOT NULL) THEN
jonathan@28772
    29
     
alberto@28800
    30
     :NEW.lastpasswordupdate := now();
jonathan@28795
    31
     
jonathan@28791
    32
   END IF;
jonathan@28772
    33
 
jonathan@28783
    34
   END AD_USER_EXPIRYPASS_TRG
jonathan@28772
    35
]]></body>
jonathan@28772
    36
    </trigger>
jonathan@28772
    37
  </database>