【问题标题】:ng-token-auth reset password not workingng-token-auth 重置密码不起作用
【发布时间】:2016-09-05 15:12:12
【问题描述】:

我已经尝试了几个小时来重置密码以使用 ng-token-auth 和 devise-token-auth

根据文档

$auth.requestPasswordReset($scope.pwdResetForm)
    .then(function(resp) {
      // handle success response
    })
    .catch(function(resp) {
      // handle error response
    });

ng-token-auth 配置

angular.module('lessons').config ( $authProvider, RESOURCES ) ->
  $authProvider.configure({
    apiUrl: RESOURCES.DOMAIN
    passwordResetPath:       '/auth/password'
    passwordUpdatePath:      '/auth/password'
  })

应向用户发送一封电子邮件,其中包含创建一次性会话的链接。我有所有的电子邮件方面的工作。

我现在得到了

Unpermitted parameters: redirect_url, password
Completed 401 Unauthorized

我的路线.rb

scope '/api' do
  mount_devise_token_auth_for 'Teacher', at: '/auth'
end

我的登录/注销和其他一切工作正常,但我似乎无法让它工作。

我尝试使用$httpurl: "/api/auth/password" 手动编写POST 没有运气。结果相同。

有什么帮助吗?漂亮请

【问题讨论】:

    标签: ruby-on-rails angularjs access-token


    【解决方案1】:

    在 application_controller.rb 中尝试添加密码:

    before_action :configure_permitted_parameters, if: :devise_controller?
    
    def configure_permitted_parameters
        devise_parameter_sanitizer.permit(:sign_up, keys: [:password])
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-22
      • 1970-01-01
      • 2016-04-30
      • 2015-08-26
      相关资源
      最近更新 更多