* Add new table and model * Store banned user username hash on delete * Prevent previously banned user from signing up again * Update method name * Refactor code and add more specs * Test improvements * Don't override existing global flash * Fix typo * Update spec description * Update schema.rb * More schema.rb fixes * Simplify spec * Update migration * Clean up migration * Rename method * Add DataDog counter * Revisit error handling * Remove spurious empty line * Make model name more explicit
26 lines
809 B
Ruby
26 lines
809 B
Ruby
module Authentication
|
|
module Errors
|
|
PREVIOUSLY_BANNED_MESSAGE = "It appears that your previous %<community_name>s " \
|
|
"account was suspended. As such, we've taken measures to prevent you from " \
|
|
"creating a new account with %<community_name>s and its community. If you " \
|
|
"think that there has been a mistake, please email us at %<community_email>s, " \
|
|
"and we will take another look.".freeze
|
|
|
|
class Error < StandardError
|
|
end
|
|
|
|
class ProviderNotFound < Error
|
|
end
|
|
|
|
class ProviderNotEnabled < Error
|
|
end
|
|
|
|
class PreviouslyBanned < Error
|
|
def message
|
|
format(PREVIOUSLY_BANNED_MESSAGE,
|
|
community_name: SiteConfig.community_name,
|
|
community_email: SiteConfig.email_addresses[:contact])
|
|
end
|
|
end
|
|
end
|
|
end
|