Announcement

Collapse
No announcement yet.

Return Code Password Änderung

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Return Code Password Änderung

    Hi,
    ich hab ein Script geschrieben, was die Kennwortänderung für unsere Umgebung aus dem OX heraus ermöglicht. (Samba, ldap). gleichzeitig prüft das Script, ob das neu eingegebene Kennwort bestimmten Richtlinien entspricht.

    Ich würde gern wissen, welche Return-Codes die GUI kennt, die ich bei Fehlern zurückgeben kann. Die 0 als "erfolgreich geändert", kennt die GUI ja :-)

    Gibt es da irgendwo eine Liste?

    Danke
    Sebbel

  • #2
    Alternativ würde ich gerne die passwort-Ändern-Seite anpassen, dass da die Kennwortrichtlinien drin stehen, dann weiß der Nutzer wenigstens, warum eine Fehlermeldung kommt.
    Ist das möglich?

    Comment


    • #3
      Hi,

      please use exit code 1 instead of 0 as described in the config file: change_pwd_script.properties

      # Script which updates the users passwd
      # Must be executable (+x) and correct interpreter set (#!/bin/bash)
      #
      # Following values are passed by the servlet to the script:
      #
      # 1. --cid - Context ID
      # 2. --username - Username of the logged in user
      # 3. --userid - User ID of the logged in user
      # 4. --oldpassword - Old user password
      # 5. --newpassword - New user password
      #
      # If script does not exit with status code 0 , an error is shown in the GUI.
      #
      #
      com.openexchange.passwordchange.script.shellscript =/bin/changepwd.sh

      Comment


      • #4
        ok, but thats the same useless error-message: Fehlermeldung: es trat ein E/A-Fehler auf (SRV-0002, -6738123123-73831)

        Is it possible to give the user a meaningful error-message what's going wrong?
        thx

        Comment


        • #5
          OK, i have found a solution.
          I have modified the javascript "register.js" at plugins/com.openexchange.user.passwordchange. The password-Validation is now directly at the gui. Only thing i have to to now is to modifiy the translation files to get localised error messages.

          Maybe you can implement the code in ox in the next version or something like that?

          Here the complete code:
          /*
          * All content on this website (including text, images, source
          * code and any other original works), unless otherwise noted,
          * is licensed under a Creative Commons License.
          *
          * http://creativecommons.org/licenses/by-nc-sa/2.5/
          *
          * Copyright (C) 2004-2010 Open-Xchange, Inc.
          * Mail: info@open-xchange.com
          */

          // following parameter enables checks, valid values are true/false
          var check_length = false
          var check_lowercase = true
          var check_uppercase = true
          var check_number = true

          // configure password-checks
          var minLength = "8"
          var lowercases = "abcdefghijklmnopqrstuvwxyz"
          var uppercases = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
          var numbers = "1234567890"

          new ox.Configuration.InnerNode("configuration/user", _("User"));

          var node = new ox.Configuration.LeafNode("configuration/user/password",
          _("Password"));
          var page = new ox.Configuration.Page(node, _("Change Password"));

          var intro = new ox.UI.Text(_("Choose a new password for your account."));
          page.addWidget(intro);

          var pass_old = new ox.UI.Password(_("Your old password"));
          page.addWidget(pass_old, "old_password");

          var pass_new = new ox.UI.Password(_("The new password"));
          page.addWidget(pass_new, "new_password");

          var pass_new2 = new ox.UI.Password(_("Confirm new password"));
          page.addWidget(pass_new2, "new_password2");

          page.save = function (data, cont) {
          function emptyPass() {
          ox.Configuration.error(_("Please enter your old password and twice the new password."));
          }
          if (pass_old.get() == "") {
          pass_old.formnode.focus();
          return emptyPass();
          } else if (pass_new.get() == "") {
          pass_new.formnode.focus();
          return emptyPass();
          } else if (pass_new2.get() == "") {
          pass_new2.formnode.focus();
          return emptyPass();
          } else if (pass_new.get() != pass_new2.get()) {
          pass_new.formnode.focus();
          ox.Configuration.error(_("The two newly entered passwords do not match."));
          return;
          } else if (check_length == true && pass_new.get().length < minLength) {
          ox.Configuration.error(_("The password length is below min length (" + minLength + ")"));
          return;
          } else if (check_lowercase == true && contains(pass_new.get(),lowercases) == false ){
          ox.Configuration.error(_("The password does not contain characters with lower cases"));
          return;
          } else if (check_uppercase == true && contains(pass_new.get(),uppercases) == false ){
          ox.Configuration.error(_("The password does not contain characters with upper cases"));
          return;
          } else if (check_number == true && contains(pass_new.get(),numbers) == false ){
          ox.Configuration.error(_("The password does not contain numbers"));
          return;
          }

          ox.JSON.put(AjaxRoot+"/passwordchange?action=update&session="+session,dat a,
          function() {
          ox.Configuration.info(
          _("Your new password has been saved."));
          cont();
          });
          }

          // sees if a password contains one of a set of characters
          function contains(password, validChars) {

          for (i = 0; i < password.length; i++) {
          var char = password.charAt(i);
          if (validChars.indexOf(char) > -1) {
          return true;
          }
          }

          return false;

          }

          Comment

          Working...
          X