enable 2FA for portal user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    enable 2FA for portal user

    Hello Yuri,

    All is on the title for 2factor authentification, do you think it can be implemented easyly for portal user ?

    Best kind regards
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • Kyle
    Senior Member
    • May 2020
    • 143

    #2
    Hi,

    I would also like to be able to enable 2FA for portal users. Is this something that is on the roadmap? or is there some steps I can do that would allow me to enable it?

    Comment

    • Kyle
      Senior Member
      • May 2020
      • 143

      #3
      Hi,
      I have updated a portal user record in the DB table: user_data with the 2FA settings and I am prompted for a code now when logging in, so the 2FA appears to work for a portal user however the UI Security Button that is available to internal users is not shown to a portal user. Does anyone have any ideas on how I can expose this button and the pop out menu it shows?

      Comment

      • Hendrik Belitz
        Junior Member
        • Aug 2020
        • 13

        #4
        I was able to get this working by patching several files. Please be aware of the fact that I am not absolutely sure whether these changes pose some security risks (although I doubt it).


        1. Allow portal users to access the UserSecurity service: You have to change several if statements in application/Espo/Services/UserSecurity.php from
        if (!$user->isAdmin() && !$user->isRegular()) throw new Forbidden();
        to
        if (!$user->isAdmin() && !$user->isRegular() && !$user->isPortal()) throw new Forbidden();
        so that the portal user is actually allowed to enable 2FA

        2. Change client/src/views/user/record/detail.js so that the Security-Button appears:
        if (
        (this.model.id == this.getUser().id || this.getUser().isAdmin() ) &&
        (this.model.isRegular() || this.model.isAdmin() ) &&
        this.getConfig().get('auth2FA')
        ) {
        this.addButton({
        name: 'viewSecurity',
        label: 'Security',
        });
        }
        has to be changed to
        if (
        (this.model.id == this.getUser().id || this.getUser().isAdmin() || this.getUser().isPortal() ) &&
        (this.model.isRegular() || this.model.isAdmin() || this.getUser().isPortal() ) &&
        this.getConfig().get('auth2FA')
        ) {
        this.addButton({
        name: 'viewSecurity',
        label: 'Security',
        });
        }

        Afterwards, you are able to enable 2FA for your portal users. And it works.

        Comment


        • eduardofendrich
          eduardofendrich commented
          Editing a comment
          Hi, I've made the changes you wrote, rebuild Espo and restarted servers, but it doesn't worked for me.

          Is there any other change to do?
      • ridek724
        Junior Member
        • Jul 2021
        • 1

        #5
        Originally posted by item
        Hello Yuri,

        All is on the title for 2factor authentification, www-uspstracking.com do you think it can be implemented easyly for portal user ?

        Best kind regards
        Now iam using this 2FA portal, it helps
        Thanks & Regards
        ritek

        Comment

      • shootify
        Member
        • May 2021
        • 77

        #6
        Can we have this added to espocrm by default, feature requested....

        Comment

        Working...