summaryrefslogtreecommitdiff
path: root/lib/nickserver/request_handlers/invalid_email_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nickserver/request_handlers/invalid_email_handler.rb')
-rw-r--r--lib/nickserver/request_handlers/invalid_email_handler.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/nickserver/request_handlers/invalid_email_handler.rb b/lib/nickserver/request_handlers/invalid_email_handler.rb
new file mode 100644
index 0000000..eaf8156
--- /dev/null
+++ b/lib/nickserver/request_handlers/invalid_email_handler.rb
@@ -0,0 +1,15 @@
+require 'nickserver/email_address'
+require 'nickserver/error_response'
+
+module Nickserver
+ module RequestHandlers
+ class InvalidEmailHandler
+ def call(request)
+ return unless request.email
+ email = EmailAddress.new(request.email)
+ ErrorResponse.new("Not a valid address") if email.invalid?
+ end
+
+ end
+ end
+end