kinoli / groupie

Assign users to specific user groups upon registration. Especially useful for front-end signup forms.
Other
3 stars 0 forks source link

Elevated Session Error #3

Closed bfjare closed 4 years ago

bfjare commented 5 years ago

Getting this issue when registering a new user

Unauthorized
This action may only be performed with an elevated session.

This is the form I am using

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="users/save-user">
    {{ redirectInput('') }}
    {% macro errorList(errors) %}
    {% if errors %}
        <ul class="errors">
            {% for error in errors %}
                <li>{{ error }}</li>
            {% endfor %}
        </ul>
    {% endif %}
    {% endmacro %}
    {% from _self import errorList %}
    <input id="groups" type="text" name="groups[]" value="2">
    <input id="firstName" type="text" name="firstName" value="">
    <input id="lastName" type="text" name="lastName" value="">
    <input id="username" type="text" name="username" value="">
    <input id="email" type="text" name="email" value="">
    <input id="password" type="password" name="password" value="">
     <input type="submit" value="Register">
</form>

Plugin currently is set with full group access. I've tried it with the group handle and id, I see craft3 does it by id in the control panel. When the form is submitted the user is created but not assigned to any groups. I feel like its a permissions error but I cant find anything missing. Especially with it creating the user succesfully.

Craft Version: 3.1.3

kinoli commented 5 years ago

I will look into this but I noticed your value param on password has 3 double quotes instead of 2. Not sure if that would make a difference, but you should fix it anyways.

On Jan 24, 2019, at 5:24 PM, Ben Fjare notifications@github.com wrote:

Getting this issue when registering a new user

Unauthorized This action may only be performed with an elevated session. This is the form I am using

{{ csrfInput() }} {{ redirectInput('') }} {% macro errorList(errors) %} {% if errors %}
    {% for error in errors %}
  • {{ error }}
  • {% endfor %}
{% endif %} {% endmacro %} {% from _self import errorList %}

Plugin currently is set with full group access. I've tried it with the group handle and id, I see craft3 does it by id in the control panel. When the form is submitted the user is created but not assigned to any groups. I feel like its a permissions error but I cant find anything missing. Especially with it creating the user succesfully.

Craft Version: 3.1.3

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kinoli/groupie/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AADwLu-qOuCoCy_4_dMGhl4cEYrgqgdLks5vGk7KgaJpZM4aR-Ah.

kinoli commented 5 years ago

I just tried your form in a local craft install and it works fine for me and adds the users to their selected groups. The issue must be a setting. Have you turned on “Allow Public Registration” in the backend user settings?

On Jan 24, 2019, at 5:24 PM, Ben Fjare notifications@github.com wrote:

Getting this issue when registering a new user

Unauthorized This action may only be performed with an elevated session. This is the form I am using

{{ csrfInput() }} {{ redirectInput('') }} {% macro errorList(errors) %} {% if errors %}
    {% for error in errors %}
  • {{ error }}
  • {% endfor %}
{% endif %} {% endmacro %} {% from _self import errorList %}

Plugin currently is set with full group access. I've tried it with the group handle and id, I see craft3 does it by id in the control panel. When the form is submitted the user is created but not assigned to any groups. I feel like its a permissions error but I cant find anything missing. Especially with it creating the user succesfully.

Craft Version: 3.1.3

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kinoli/groupie/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AADwLu-qOuCoCy_4_dMGhl4cEYrgqgdLks5vGk7KgaJpZM4aR-Ah.

bfjare commented 5 years ago

I'm sure its a setting issue just can't find what it is. I do have that setting on. The quotes on the password field is a copy / paste typo.

screen shot 2019-01-25 at 9 13 48 am

The person registering the user is logged in would that create an issue?

kinoli commented 5 years ago

Can you try adding this to config/general.php?

'elevatedSessionDuration' => 0

I don't see this as a permanent fix and I will look into a cleaner fix when I get some time. Hopefully soon.

bfjare commented 5 years ago

Confirming this works with the config edit