ng-token-auth
ng-token-auth copied to clipboard
Resend Confirmation Email
Hi,
Is it possible to resend a confirmation email? I don't see the hooks in the API.
Thanks,
Sam
I've dug into this a little further. The devise ConfirmationsController exposes two public methods, create and show, but devise_token_auth only defines show, not create. So it seems like devise_token_auth doesn't have the capability to resend confirmation emails, which would need to be the first step.
@samstickland - I don't believe reconfirmation has been implemented. I'll be doing extensive work on this gem over the next few days, and I'll see what I can do about this issue.
Excellent, thanks! Let me know if you want me to do any testing.
Any updates on this?
Would love to hear if there's any updates on this as well.
I managed to add this by overriding confirmations controller as below and making calls to POST /auth/confirmation
If this looks good, I am happy to make a pull request.
mount_devise_token_auth_for 'User', at: '/auth', controllers: {
confirmations: 'api/v1/confirmations'
}
class Api::V1::ConfirmationsController < DeviseTokenAuth::ConfirmationsController
def create
unless resource_params[:email]
return render json: {
success: false,
errors: ['You must provide an email address.']
}, status: 400
end
unless params[:redirect_url]
return render json: {
success: false,
errors: ['Missing redirect url.']
}, status: 400
end
if resource_class.case_insensitive_keys.include?(:email)
email = resource_params[:email].downcase
else
email = resource_params[:email]
end
q = "uid = ? AND provider='email'"
# fix for mysql default case insensitivity
if ActiveRecord::Base.connection.adapter_name.downcase.starts_with? 'mysql'
q = "BINARY uid = ? AND provider='email'"
end
@resource = resource_class.where(q, email).first
errors = nil
if @resource
@resource.send_confirmation_instructions({
redirect_url: params[:confirm_success_url],
client_config: params[:config_name]
})
else
errors = ["Unable to find user with email '#{email}'."]
end
if errors
render json: {
success: false,
errors: errors
}, status: 400
else
render json: {
status: 'success',
data: @resource.as_json
}
end
end
end
Any updates on this? Can't see anything on this in the docs.
+1
+1
+1
@lynndylanhurley can we start adding "need help" labels to tickets like these. You don't have to do all the work. I'll even learn coffee-script if i have too 😝
looks like we already had a helps wanted
label already =]
This is not ng-token-auth
issue, but devise_token_auth
.
Can you please submit a PR to this repo?
Thanks in advance.
hi! Any update on this?