Limit user access to account page only

Iā€™m creating a user role that allows them to only edit their own account (email, password, a bunch of fields). But panel login redirects to panel/site where they canā€™t do anything so I want to redirect them to panel/account. But I donā€™t know how.

Overriding that route (and doing a role check) in config.php doesnā€™t work.

Setting the panel permissions for that role like so crashes the login process:

permissions:
  access:
    site: false
    settings: false
    users: false

Try this:

permissions:
  access:
    users: false
    settings: false
  site: false
  pages: false
  user:
    changeRole: false
    changeName: false
    delete: false

May be you want to change the lines after ā€œuser:ā€.

Details you can find at: Docs: User permissions

Thatā€™s what I have (more or less). To be clear: I have no trouble limiting editing permissions. I want the user to only see their account page after login, not the site dashboard.

The reason is: since they can only edit their account, itā€™s bad UX to show them something else after login and have the only page they can actually edit hidden in the menu.

@phm Since you canā€™t redirect from a hook, maybe you can use a custom Panel login that redirects to the account. Or use a custom login form on the frontend.

Aha, the custom Panel login seems like a solution. Will try that, thanks.

Upvoted the login hooks github issue though, that would be easier :slight_smile:

is it still so that you cannot forward the user to his account page with the hook ā€˜user.login: afterā€™?