1
사용자 비밀번호를 변경하려고했지만 성공적으로 변경되었지만 사용자가 승인되지 않아 이후에 아무 것도 할 수 없도록했습니다 ... 비밀번호를 다시 인증하는 부분이 누락되었습니다. 사용자 계정 비밀번호 변경
이
내가 암호를 업데이트 할 수 있지만 사용자가 무단으로되기 때문에 다시 응용 프로그램을 액세스하는 데 문제가 있습니다 자신의 암호를def password
if current_user.valid_password?(params[:current_password])
current_user.password = params[:new_password]
if current_user.save
#sign them in
#tried doing this to sign them in again but didn't work
sign_in(:user, current_user)
response.headers['X-CSRF-Token'] = form_authenticity_token
response.headers['X-Pyne-Auth'] = current_user.authentication_token
render :json => {:success => true} and return
else
render :json => {:success => false, error: "Unexpected error while trying to save user. Please try again."} and return
end
else
render :json => {:success => false, error: "Your current password is incorrect. Please try again"} and return
end
end
을 업데이트 내 코드입니다.
는 in the Devise wiki을 제안 당신이
나는 그 위키와 정확히 똑같이 간다.'@ user.update (user_params)'... 그냥 다른 곳으로 들어가면 @Brian – Walker
'update'와 같은 소리가 나지 않는다. 그때. 콘솔에 업데이트를 방해하고있는 것이 있습니까? 또는 else 절의'@ user.errors.full_messages'를보고 무슨 일이 일어나는지 볼 수 있습니다. – Brian
브라이언, 내 사용자 컨트롤러에서 그렇게하고 있었는데 방금 다음과 같이 내 경로'devise_for : users, : controllers => {: sessions => "api/v1/sessions", passwords : 'api/패스워드 '}, : path_prefix =>'api/v1'' 이것은 컨트롤러 중 하나에 있어야한다는 것을 의미합니까? – Walker