Skip to content

Commit 5a162e6

Browse files
committed
Better email validation for @helsinki.fi users
1 parent f803a7f commit 5a162e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/models/user.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ def reject_common_login_mistakes
304304
return if !login || login.empty?
305305
errors.add(:login, "may not be your email address. Keep in mind that your username is public to everyone.") if login.include?('@')
306306
errors.add(:login, "may not be a number. Use the organizational identifier field for your student number.") if login.scan(/\D/).empty?
307-
errors.add(:email, 'may not end with "@ad.helsinki.fi". You cannot receive any emails with this address -- it\'s only used for your webmail login. Remove the "ad."-part of the address and try again.') if email.end_with?('@ad.helsinki.fi')
307+
errors.add(:email, 'may not end with "@ad.helsinki.fi". You cannot receive any emails with this address -- it\'s only used for your webmail login. Figure out what your real email address is and try again. It is usually of the form [email protected] but verify this first.') if email.end_with?('@ad.helsinki.fi')
308+
errors.add(:email, 'is incorrect. You probably meant [email protected]. Keep in mind that your email address does not contain your University of Helsinki username.') if email.end_with?('@helsinki.fi') && !/.*\..*@helsinki.fi/.match?(email)
308309
end
309310
end

0 commit comments

Comments
 (0)