larrabee / freeipa-password-reset

Self-service password reset app for FreeIPA
GNU General Public License v3.0
88 stars 30 forks source link

Mobile instead telephoneNumber #19

Closed orynkanov closed 4 years ago

orynkanov commented 4 years ago

Hello! How to use mobile attribute instead of telephoneNumber? I tried replacing providers.py in the file, but it does not work.

larrabee commented 4 years ago

Привет, да, тебе надо заменить все места с telephoneNumber на mobilephoneNumber (посмотреть как называется поле можно через какой нибудь ldap клиент).

orynkanov commented 4 years ago

Эта строка "telephoneNumber" находится только в файле providers.py. Я её заменил на mobile (посмотрел в LDAP). Но при шаге 2 - ошибка. Хотя точно у пользователя есть правильный номер телефона. ipa-mobile

larrabee commented 4 years ago

Попробуй в send_token добавить print(user['result']), что бы посмотреть, что в объекте юзер. Похоже у пользователя ldap-password-reset нет права читать это поле.

orynkanov commented 4 years ago

Мы разобрались в чем было дело: в pwdmanager.py в "def __get_user(self, uid):" запрашивается информация о пользователе так -user = api.Command.user_show(uid=unicode(uid)). При этом отображается только атрибут (телефонный) - telephoneNumber. Если запрашивать так - user = api.Command.user_show(uid=unicode(uid), all=True), то mobile тоже показывается и другие не пустые атрибуты тоже.

larrabee commented 4 years ago

Спасибо за развернутый ответ, я добавил функционал по смены имени атрибута в мастер.