Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added more logic to the show method

  • Loading branch information...
commit cd38de048701f8629e0cd50fc72ea8821039ca34 1 parent 3f1100d
@dwilkie authored
View
5 app/controllers/devise/paypal_authentications_controller.rb
@@ -22,6 +22,7 @@ def show
if @paypal_authentication.token_param_valid?
@paypal_authentication.get_authentication_details!
else
+ @paypal_authentication.destroy
url = new_paypal_authentication_path(resource_name)
end
else
@@ -29,6 +30,10 @@ def show
end
end
else
+ set_flash_message(
+ :error,
+ :something_went_wrong_when_contacting_paypal
+ ) if session[:paypal_authentication_id]
url = new_paypal_authentication_path(resource_name)
end
redirect_to url if url
View
3  app/models/devise/paypal_authentication.rb
@@ -5,7 +5,8 @@ class Devise::PaypalAuthentication < ActiveRecord::Base
serialize :params
validates :token,
- :uniqueness => true
+ :uniqueness => true,
+ :allow_nil => true
def get_authentication_token!(permissions = {})
self.update_attributes!(
View
5 config/locales/en.yml
@@ -1,6 +1,5 @@
en:
devise:
- paypal_authable:
- success: "Successfully authorized from Paypal account."
- failure: "Unable to authorize you from Paypal account."
+ paypal_authentications:
+ something_went_wrong_when_contacting_paypal: "Sorry something went wrong when contacting Paypal. Please try again in a few minutes."
Please sign in to comment.
Something went wrong with that request. Please try again.