Can't login Customer User Backend - ODBC MSSQL

Moderator: crythias

Locked
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Can't login Customer User Backend - ODBC MSSQL

Post by rzima »

Hi,
I have a problem with logging to customer user. I configured database backend using ODBC (FreeTDS) Connection to MSSQL - Works Fine ( Topic: viewtopic.php?f=62&t=33606) . I see customer user data in OTRS Admin Panel. I can modify password for each customer user and I see password in Database (with SHA256 hash), but I can't login with this authentication data!
When logging as customer user i see: Login failed! An incorrect username or password.

My actual Config.pl

Code: Select all

    $Self->{CustomerUser} = {
        Name   => 'Baza Prof',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
            DSN  => 'DBI:ODBC:SQLSRV01',
            Type => 'mssql', # only for ODBC connections
#            DSN => 'DBI:mysql:database=customerdb;host=customerdbhost',
            User => 'OTRS',
            Password => 'pass',
            Table => 'vwOTRSKlienciUzytkownicy',
            ForeignDB => 1,    # wloczone /  set this to 1 if your table does not have create_time, create_by, change_time and change_by fields

            #SourceCharset => 'utf-8',
            #DestCharset => 'utf-8',
            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            CaseSensitive => 0,
        },

        # customer unique id
        CustomerKey => 'login',

        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',

        # The last field must always be the email address so that a valid
        #   email address like "John Doe" <john.doe@domain.com> can be constructed from the fields.
        CustomerUserListFields => [ 'first_name', 'last_name', 'email' ],

#        CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
        CustomerUserSearchFields           => [ 'login', 'first_name', 'last_name', 'customer_id' ],
        CustomerUserSearchPrefix           => '*',
        CustomerUserSearchSuffix           => '*',
        CustomerUserSearchListLimit        => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields             => [ 'first_name', 'last_name' ], #usunieto 'title,'
        CustomerUserEmailUniqCheck         => 1,

#        # show now own tickets in customer panel, CompanyTickets
#        CustomerUserExcludePrimaryCustomerID => 0,
#        # generate auto logins
#        AutoLoginCreation => 0,
#        # generate auto login prefix
#        AutoLoginCreationPrefix => 'auto',
#        # admin can change customer preferences
#        AdminSetPreferences => 1,
        # use customer company support (reference to company, See CustomerCompany settings)
        CustomerCompanySupport => 1,
        # cache time to live in sec. - cache any database queries
        CacheTTL => 0, #60 * 60 * 24,
#        # just a read only source
        ReadOnly => 0, #wlaczone

        Map => [
            # note: Login, Email and CustomerID needed!
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link cla$
           # [ 'UserTitle',      Translatable('Title or salutation'), 'title',  1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
#            [ 'UserEmail',      Translatable('Email'), 'email',           1, 1, 'var', '[% Env("CGIHandle") %]?Action=AgentTicketComp$
            [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
#            [ 'UserCustomerIDs', Translatable('CustomerIDs'), 'customer_ids', 1, 0, 'var', '', 0 ],
            [ 'UserPhone',       'Phone',       'phone',        1, 0, 'var', '', 0 ],
           # [ 'UserFax',          Translatable('Fax'),         'fax',          1, 0, 'var', '', 0 ],
            [ 'UserMobile',      'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
           # [ 'UserStreet',       Translatable('Street'),      'street',       1, 0, 'var', '', 0 ],
           # [ 'UserZip',          Translatable('Zip'),         'zip',          1, 0, 'var', '', 0 ],
           # [ 'UserCity',         Translatable('City'),        'city',         1, 0, 'var', '', 0 ],
           # [ 'UserCountry',      Translatable('Country'),     'country',      1, 0, 'var', '', 0 ],
           # [ 'UserComment',      Translatable('Comment'),     'comments',     1, 0, 'var', '', 0 ],
            [ 'ValidID',         'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
        ],

        # default selections
#1        Selections => {

#            UserTitle => {
#                'Mr.' => Translatable('Mr.'),
#                'Mrs.' => Translatable('Mrs.'),
#            },
#1        },
    };
Shoud I add additonal configuration like AuthModule https://otrs.github.io/doc/manual/admin ... backend-db for this backend or add encoding charset parameter?


I will be grateful for your help :)
root
Administrator
Posts: 4253
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Can't login Customer User Backend - ODBC MSSQL

Post by root »

Yes, you have to add AuthModule configuration.
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
rzima
Znuny newbie
Posts: 25
Joined: 04 Aug 2016, 08:37
Znuny Version: 6.0.13
Real Name: rzima

Re: Can't login Customer User Backend - ODBC MSSQL

Post by rzima »

Thanks for reply.
I added several lines to Config.pm

Code: Select all

    $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::DB';
    $Self->{'Customer::AuthModule::DB::Table'} = 'vwOTRSKlienciUzytkownicy';
    $Self->{'Customer::AuthModule::DB::CustomerKey'} = 'login';
    $Self->{'Customer::AuthModule::DB::CustomerPassword'} = 'pw';
    $Self->{'Customer::AuthModule::DB::DSN'} = "DBI:ODBC:SQLSRV01";
    $Self->{'Customer::AuthModule::DB::User'} = "OTRS";
    $Self->{'Customer::AuthModule::DB::Password'} = "pass";
    $Self->{'Customer::AuthModule::DB::Type'} = "mssql";
Next I try to login and is error:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at helpdesk@prof.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
LOG: /var/log/apache2/error.log

Code: Select all

[Thu Nov 17 15:12:34 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:13:57 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:14:01 2016] -e: Malformed UTF-8 character (unexpected end of string) in substitution (s///) at /opt/otrs//Kernel/System/DB/mysql.pm line 113.
[Thu Nov 17 15:14:04 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:14:04 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:14:13 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:19:30 2016] Config.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config.pm line 14.
[Thu Nov 17 15:19:34 2016] -e: Malformed UTF-8 character (unexpected end of string) in substitution (s///) at /opt/otrs//Kernel/System/DB/mysql.pm line 113.
In MSSQL i have encoding: polish_ci_as. In odbc.ini default encoding.
How to check encoding in OTRS and what paramerer add to Config.pm?
Help :?
Locked