Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpermitted parameters: confirm_success_url, config_name, registration #501

Closed
stephannv opened this issue Jan 19, 2016 · 1 comment
Closed

Comments

@stephannv
Copy link

I'm using devise_token_auth and ng-token-auth

Error:

Started POST "/auth" for ::1 at 2016-01-19 15:04:04 -0300
Processing by DeviseTokenAuth::RegistrationsController#create as HTML
  Parameters: {"password"=>"[FILTERED]", "cpf"=>"xxxxxxxxx", "confirm_success_url"=>"http://172.16.0.234:8100/#/sign-up", "config_name"=>"default", "registration"=>{"password"=>"[FILTERED]", "cpf"=>"xxxxxxxxx", "confirm_success_url"=>"http://172.16.0.234:8100/#/sign-up", "config_name"=>"default"}}
Can't verify CSRF token authenticity
Unpermitted parameters: confirm_success_url, config_name, registration
Unpermitted parameters: confirm_success_url, config_name, registration
Unpermitted parameters: confirm_success_url, config_name, registration
(0.3ms)  BEGIN
   (0.7ms)  SELECT COUNT(*) FROM "clientes" WHERE "clientes"."provider" = $1 AND "clientes"."email" IS NULL  [["provider", "email"]]
   (0.3ms)  ROLLBACK
Completed 403 Forbidden in 112ms (Views: 0.6ms | ActiveRecord: 5.2ms)

My ApplicationController

...
before_action :configure_permitted_parameters, if: :devise_controller?

protected

def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) << [:name, :cpf ]
end
...

my angular controller

function signUp( cliente ) {
    $auth.submitRegistration({
        email: cliente.email,
        password: cliente.password,
        password_confirmation: cliente.passwordConfirmation,
        name: cliente.name,
        cpf: cliente.cpf,
    }).then( signUpSucess ).catch( signUpError );
};

my form

<form ng-submit="signUp(cliente)" role="form" ng-init="cliente = {}">
    <div class="list">
        <label class="item item-input item-floating-label">
            <span class="input-label">Email</span>
            <input type="email" name="email" placeholder="Email" ng-model="cliente.model" required="required">
        </label>

        <label class="item item-input item-floating-label">
            <span class="input-label">CPF</span>
            <input type="text" name="cpf" placeholder="CPF" ng-model="cliente.cpf" required="required">
        </label>

        <label class="item item-input item-floating-label">
            <span class="input-label">Nome</span>
            <input type="text" name="nome" placeholder="Nome" ng-model="cliente.nome" required="required">
        </label>

        <label class="item item-input item-floating-label">
            <span class="input-label">Senha</span>
            <input type="password" name="password" placeholder="Senha" ng-model="cliente.password" required="required">
        </label>

        <label class="item item-input item-floating-label">
            <span class="input-label">Confirmação de Senha</span>
            <input type="password" name="password_confirmation" placeholder="Confirmação de Senha" ng-model="cliente.password_confirmation" required="required">
        </label>
    </div>

    <button class="button button-block button-positive activated">Cadastrar-se</button>
</form>

When I add confirm_success_url, config_name, registration to permitted params, I got this error:

ActiveRecord::UnknownAttributeError (unknown attribute 'confirm_success_url' for Cliente.):

I'm using:
devise_token_auth (0.1.36)
ng-token-auth (0.0.28)

@stephannv
Copy link
Author

I find my error:
ng-model="cliente.model"
is supposed to be
ng-model="cliente.email"

Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant