From 94a5654371812905c154f29cef393d42f13c5eaa Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Tue, 18 Feb 2014 18:16:28 -0500 Subject: Added the generate shell command. Please do not commit the generated files. --- app/models/match.rb | 2 ++ app/models/server.rb | 2 ++ app/models/team.rb | 2 ++ app/models/tournament.rb | 2 ++ app/models/user.rb | 2 ++ 5 files changed, 10 insertions(+) create mode 100644 app/models/match.rb create mode 100644 app/models/server.rb create mode 100644 app/models/team.rb create mode 100644 app/models/tournament.rb create mode 100644 app/models/user.rb (limited to 'app/models') diff --git a/app/models/match.rb b/app/models/match.rb new file mode 100644 index 0000000..0836114 --- /dev/null +++ b/app/models/match.rb @@ -0,0 +1,2 @@ +class Match < ActiveRecord::Base +end diff --git a/app/models/server.rb b/app/models/server.rb new file mode 100644 index 0000000..120f0fa --- /dev/null +++ b/app/models/server.rb @@ -0,0 +1,2 @@ +class Server < ActiveRecord::Base +end diff --git a/app/models/team.rb b/app/models/team.rb new file mode 100644 index 0000000..fa7ba9e --- /dev/null +++ b/app/models/team.rb @@ -0,0 +1,2 @@ +class Team < ActiveRecord::Base +end diff --git a/app/models/tournament.rb b/app/models/tournament.rb new file mode 100644 index 0000000..da3da0e --- /dev/null +++ b/app/models/tournament.rb @@ -0,0 +1,2 @@ +class Tournament < ActiveRecord::Base +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..4a57cf0 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ActiveRecord::Base +end -- cgit v1.2.3-2-g168b From 96b97d691f6889004c38bef15411bc27e448fda1 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Tue, 18 Feb 2014 20:42:51 -0500 Subject: Changes to generate.sh --- app/models/alert.rb | 2 ++ app/models/pm.rb | 2 ++ app/models/server_settings.rb | 2 ++ app/models/team_match_pair.rb | 2 ++ app/models/user_team_pair.rb | 2 ++ 5 files changed, 10 insertions(+) create mode 100644 app/models/alert.rb create mode 100644 app/models/pm.rb create mode 100644 app/models/server_settings.rb create mode 100644 app/models/team_match_pair.rb create mode 100644 app/models/user_team_pair.rb (limited to 'app/models') diff --git a/app/models/alert.rb b/app/models/alert.rb new file mode 100644 index 0000000..e61a702 --- /dev/null +++ b/app/models/alert.rb @@ -0,0 +1,2 @@ +class Alert < ActiveRecord::Base +end diff --git a/app/models/pm.rb b/app/models/pm.rb new file mode 100644 index 0000000..24d6eb4 --- /dev/null +++ b/app/models/pm.rb @@ -0,0 +1,2 @@ +class Pm < ActiveRecord::Base +end diff --git a/app/models/server_settings.rb b/app/models/server_settings.rb new file mode 100644 index 0000000..7f49863 --- /dev/null +++ b/app/models/server_settings.rb @@ -0,0 +1,2 @@ +class ServerSettings < ActiveRecord::Base +end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb new file mode 100644 index 0000000..24a4e86 --- /dev/null +++ b/app/models/team_match_pair.rb @@ -0,0 +1,2 @@ +class TeamMatchPair < ActiveRecord::Base +end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb new file mode 100644 index 0000000..7694996 --- /dev/null +++ b/app/models/user_team_pair.rb @@ -0,0 +1,2 @@ +class UserTeamPair < ActiveRecord::Base +end -- cgit v1.2.3-2-g168b From cd1fabe40ca4d290df33a2590f3a1f2072103972 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Thu, 20 Feb 2014 17:13:51 -0500 Subject: fix datatype names in generate.sh --- app/models/alert.rb | 1 + app/models/match.rb | 1 + app/models/pm.rb | 2 ++ app/models/team_match_pair.rb | 2 ++ app/models/user_team_pair.rb | 2 ++ 5 files changed, 8 insertions(+) (limited to 'app/models') diff --git a/app/models/alert.rb b/app/models/alert.rb index e61a702..343c269 100644 --- a/app/models/alert.rb +++ b/app/models/alert.rb @@ -1,2 +1,3 @@ class Alert < ActiveRecord::Base + belongs_to :author end diff --git a/app/models/match.rb b/app/models/match.rb index 0836114..533435a 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,2 +1,3 @@ class Match < ActiveRecord::Base + belongs_to :tournament end diff --git a/app/models/pm.rb b/app/models/pm.rb index 24d6eb4..ab5af3b 100644 --- a/app/models/pm.rb +++ b/app/models/pm.rb @@ -1,2 +1,4 @@ class Pm < ActiveRecord::Base + belongs_to :author + belongs_to :recipient end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb index 24a4e86..85f8eaa 100644 --- a/app/models/team_match_pair.rb +++ b/app/models/team_match_pair.rb @@ -1,2 +1,4 @@ class TeamMatchPair < ActiveRecord::Base + belongs_to :team + belongs_to :match end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb index 7694996..c55dc2e 100644 --- a/app/models/user_team_pair.rb +++ b/app/models/user_team_pair.rb @@ -1,2 +1,4 @@ class UserTeamPair < ActiveRecord::Base + belongs_to :user + belongs_to :team end -- cgit v1.2.3-2-g168b From 8e3e88f52c1f2d73acdcb7fdf60326b5f7717068 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Wed, 26 Feb 2014 20:07:42 -0500 Subject: Possibly broke everything. Added another model for populating tournament options. --- app/models/tournament_options.rb | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/models/tournament_options.rb (limited to 'app/models') diff --git a/app/models/tournament_options.rb b/app/models/tournament_options.rb new file mode 100644 index 0000000..8ed6433 --- /dev/null +++ b/app/models/tournament_options.rb @@ -0,0 +1,2 @@ +class TournamentOptions < ActiveRecord::Base +end -- cgit v1.2.3-2-g168b From 3a7b14f4a51c0fdb8b71720f361a0a8ccf080325 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Feb 2014 16:59:04 -0500 Subject: add game types --- app/models/game.rb | 2 ++ app/models/game_attribute.rb | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 app/models/game.rb create mode 100644 app/models/game_attribute.rb (limited to 'app/models') diff --git a/app/models/game.rb b/app/models/game.rb new file mode 100644 index 0000000..a181c26 --- /dev/null +++ b/app/models/game.rb @@ -0,0 +1,2 @@ +class Game < ActiveRecord::Base +end diff --git a/app/models/game_attribute.rb b/app/models/game_attribute.rb new file mode 100644 index 0000000..c12723b --- /dev/null +++ b/app/models/game_attribute.rb @@ -0,0 +1,3 @@ +class GameAttribute < ActiveRecord::Base + belongs_to :game +end -- cgit v1.2.3-2-g168b From de40ec53e8b80d8d880214183f19ea93172a0026 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Feb 2014 17:02:10 -0500 Subject: give tournaments a game type --- app/models/tournament.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models') diff --git a/app/models/tournament.rb b/app/models/tournament.rb index da3da0e..cc915a0 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -1,2 +1,3 @@ class Tournament < ActiveRecord::Base + belongs_to :game end -- cgit v1.2.3-2-g168b From 2eb242f3e5b1f1ab66d84556cabcad965fe387aa Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sat, 1 Mar 2014 20:23:29 -0500 Subject: changed the user section of the generate --- app/models/tournament_option.rb | 2 ++ app/models/tournament_options.rb | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 app/models/tournament_option.rb delete mode 100644 app/models/tournament_options.rb (limited to 'app/models') diff --git a/app/models/tournament_option.rb b/app/models/tournament_option.rb new file mode 100644 index 0000000..950b351 --- /dev/null +++ b/app/models/tournament_option.rb @@ -0,0 +1,2 @@ +class TournamentOption < ActiveRecord::Base +end diff --git a/app/models/tournament_options.rb b/app/models/tournament_options.rb deleted file mode 100644 index 8ed6433..0000000 --- a/app/models/tournament_options.rb +++ /dev/null @@ -1,2 +0,0 @@ -class TournamentOptions < ActiveRecord::Base -end -- cgit v1.2.3-2-g168b From eaf3d3cddf418c560c9619f722ea1dbc5d6cc61a Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 15:59:50 -0500 Subject: currently adding Session controller and view --- app/models/alert.rb | 3 +++ app/models/game.rb | 2 ++ app/models/game_attribute.rb | 3 +++ app/models/match.rb | 3 +++ app/models/pm.rb | 4 ++++ app/models/server.rb | 2 ++ app/models/server_settings.rb | 2 ++ app/models/team.rb | 2 ++ app/models/team_match_pair.rb | 4 ++++ app/models/tournament.rb | 3 +++ app/models/tournament_option.rb | 2 ++ app/models/user.rb | 2 ++ app/models/user_team_pair.rb | 4 ++++ 13 files changed, 36 insertions(+) create mode 100644 app/models/alert.rb create mode 100644 app/models/game.rb create mode 100644 app/models/game_attribute.rb create mode 100644 app/models/match.rb create mode 100644 app/models/pm.rb create mode 100644 app/models/server.rb create mode 100644 app/models/server_settings.rb create mode 100644 app/models/team.rb create mode 100644 app/models/team_match_pair.rb create mode 100644 app/models/tournament.rb create mode 100644 app/models/tournament_option.rb create mode 100644 app/models/user.rb create mode 100644 app/models/user_team_pair.rb (limited to 'app/models') diff --git a/app/models/alert.rb b/app/models/alert.rb new file mode 100644 index 0000000..343c269 --- /dev/null +++ b/app/models/alert.rb @@ -0,0 +1,3 @@ +class Alert < ActiveRecord::Base + belongs_to :author +end diff --git a/app/models/game.rb b/app/models/game.rb new file mode 100644 index 0000000..a181c26 --- /dev/null +++ b/app/models/game.rb @@ -0,0 +1,2 @@ +class Game < ActiveRecord::Base +end diff --git a/app/models/game_attribute.rb b/app/models/game_attribute.rb new file mode 100644 index 0000000..c12723b --- /dev/null +++ b/app/models/game_attribute.rb @@ -0,0 +1,3 @@ +class GameAttribute < ActiveRecord::Base + belongs_to :game +end diff --git a/app/models/match.rb b/app/models/match.rb new file mode 100644 index 0000000..533435a --- /dev/null +++ b/app/models/match.rb @@ -0,0 +1,3 @@ +class Match < ActiveRecord::Base + belongs_to :tournament +end diff --git a/app/models/pm.rb b/app/models/pm.rb new file mode 100644 index 0000000..ab5af3b --- /dev/null +++ b/app/models/pm.rb @@ -0,0 +1,4 @@ +class Pm < ActiveRecord::Base + belongs_to :author + belongs_to :recipient +end diff --git a/app/models/server.rb b/app/models/server.rb new file mode 100644 index 0000000..120f0fa --- /dev/null +++ b/app/models/server.rb @@ -0,0 +1,2 @@ +class Server < ActiveRecord::Base +end diff --git a/app/models/server_settings.rb b/app/models/server_settings.rb new file mode 100644 index 0000000..7f49863 --- /dev/null +++ b/app/models/server_settings.rb @@ -0,0 +1,2 @@ +class ServerSettings < ActiveRecord::Base +end diff --git a/app/models/team.rb b/app/models/team.rb new file mode 100644 index 0000000..fa7ba9e --- /dev/null +++ b/app/models/team.rb @@ -0,0 +1,2 @@ +class Team < ActiveRecord::Base +end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb new file mode 100644 index 0000000..85f8eaa --- /dev/null +++ b/app/models/team_match_pair.rb @@ -0,0 +1,4 @@ +class TeamMatchPair < ActiveRecord::Base + belongs_to :team + belongs_to :match +end diff --git a/app/models/tournament.rb b/app/models/tournament.rb new file mode 100644 index 0000000..cc915a0 --- /dev/null +++ b/app/models/tournament.rb @@ -0,0 +1,3 @@ +class Tournament < ActiveRecord::Base + belongs_to :game +end diff --git a/app/models/tournament_option.rb b/app/models/tournament_option.rb new file mode 100644 index 0000000..950b351 --- /dev/null +++ b/app/models/tournament_option.rb @@ -0,0 +1,2 @@ +class TournamentOption < ActiveRecord::Base +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..4a57cf0 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ActiveRecord::Base +end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb new file mode 100644 index 0000000..c55dc2e --- /dev/null +++ b/app/models/user_team_pair.rb @@ -0,0 +1,4 @@ +class UserTeamPair < ActiveRecord::Base + belongs_to :user + belongs_to :team +end -- cgit v1.2.3-2-g168b From 21f151629004dbcd28b4576f256ad213aee1bdb2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 3 Mar 2014 18:41:50 -0500 Subject: app/models/user.rb: indent --- app/models/user.rb | 247 +++++++++++++++++++++++------------------------------ 1 file changed, 105 insertions(+), 142 deletions(-) (limited to 'app/models') diff --git a/app/models/user.rb b/app/models/user.rb index 55a7da0..a4fafa0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,158 +1,121 @@ class User < ActiveRecord::Base -before_save { self.email = email.downcase } -before_save { self.user_name = user_name.downcase } - -=begin - -Rails looks for the create_remember_token and runs the method -before anything else. - -This method cannot be called by a user since it is denoted -as private. - -=end - -before_create :create_remember_token - -=begin - -VAILD_EMAIL is the regex used to valid a user given email. - -A break down of the regex is listed below. - -/ -------------> Start of the regex -\A ------------> match start of a string -[\w+\-.]+ -----> at least one owrd character, plus, hyphen, or - dot -@ -------------> literal ampersand -[a-z\d\-.]+ ---> at least one letter, digit, hyphen, or dot -(?:\.[a-z]+) --> ensures that the error of example@foo..com - does not occur -\z ------------> match end of a string -/ -------------> end of the regex -i -------------> case sensative - -=end - + before_save { self.email = email.downcase } + before_save { self.user_name = user_name.downcase } + + ## + # Rails looks for the create_remember_token and runs the method + # before anything else. + # + # This method cannot be called by a user since it is denoted + # as private. + before_create :create_remember_token + + ## + # VAILD_EMAIL is the regex used to valid a user given email. + # + # A break down of the regex is listed below. + # + # / -------------> Start of the regex + # \A ------------> match start of a string + # [\w+\-.]+ -----> at least one owrd character, plus, hyphen, + # or dot + # @ -------------> literal ampersand + # [a-z\d\-.]+ ---> at least one letter, digit, hyphen, or dot + # (?:\.[a-z]+) --> ensures that the error of example@foo..com + # does not occur + # \z ------------> match end of a string + # / -------------> end of the regex + # i -------------> case insensative VALID_EMAIL_REG = /\A[\w+\-.]+@[a-z\d\-.]+(?:\.[a-z]+)\z/i -=begin - -VALID_USER_NAME checks to make sure a user's user_name -is in the proper format. - -=end - + ## + # VALID_USER_NAME checks to make sure a user's user_name + # is in the proper format. VALID_USER_NAME_REG = /[a-zA-Z0-9\-]/ -=begin - -The following lines put a user accout through a series of -validations in order to make sure all of their information -is in the proper format. - -validates :symbol_to_be_valided - -presence: determines whether or not a symbol is filled or not -length: ensures there is a length limit on the symbol -format: checks the format of given information to ensure - validity - -=end - - validates :name, presence: true, length: { maximum: 50 } - validates :email, presence: true, format: {with: - VALID_EMAIL_REG}, - uniqueness: { case_sensitive: false } - validates :user_name, presence: true, length:{maximum: 50}, - format: {with: VALID_USER_NAME_REG }, - uniqueness: {case_sensitive: false } - -=begin - -Instead of adding password and password_confirmation -attributes, requiring the presence of a password, -requirin that pw and pw_com match, and add an authenticate -method to compare an encrypted password to the -password_digest to authenticate users, I can just add -has_secure_password which does all of this for me. - -=end - + ## + # The following lines put a user accout through a series of + # validations in order to make sure all of their information + # is in the proper format. + # + # validates :symbol_to_be_valided + # + # - presence: determines whether or not a symbol is filled or not + # - length: ensures there is a length limit on the symbol + # - format: checks the format of given information to ensure + # validity + validates(:name, presence: true, length: { maximum: 50 }) + validates(:email, presence: true, format: {with: + VALID_EMAIL_REG}, + uniqueness: { case_sensitive: false }) + validates(:user_name, presence: true, length:{maximum: 50}, + format: {with: VALID_USER_NAME_REG }, + uniqueness: {case_sensitive: false }) + + ## + # Instead of adding password and password_confirmation + # attributes, requiring the presence of a password, + # requirin that pw and pw_com match, and add an authenticate + # method to compare an encrypted password to the + # password_digest to authenticate users, I can just add + # has_secure_password which does all of this for me. has_secure_password validates :password, length: { minimum: 6 } -=begin - - Create a random remember token for the user. This will be - changed every time the user creates a new session. - - By changing the cookie every new session, any hijacked sessions - (where the attacker steals a cookie to sign in as a certain - user) will expire the next time the user signs back in. - - The random string is of length 16 composed of A-Z, a-z, 0-9 - This is the browser's cookie value. - -=end - - def User.new_remember_token - SecureRandom.urlsafe_base64 - end - -=begin - - Encrypt the remember token. - This is the encrypted version of the cookie stored on - the database. - - The reasoning for storing a hashed token is so that even if - the database is compromised, the atacker won't be able to use - the remember tokens to sign in. - -=end - - def User.hash(token) - Digest::SHA1.hexdigest(token.to_s) - end + ## + # Create a random remember token for the user. This will be + # changed every time the user creates a new session. + # + # By changing the cookie every new session, any hijacked sessions + # (where the attacker steals a cookie to sign in as a certain + # user) will expire the next time the user signs back in. + # + # The random string is of length 16 composed of A-Z, a-z, 0-9 + # This is the browser's cookie value. + def User.new_remember_token + SecureRandom.urlsafe_base64 + end + + ## + # Encrypt the remember token. + # This is the encrypted version of the cookie stored on + # the database. + # + # The reasoning for storing a hashed token is so that even if + # the database is compromised, the atacker won't be able to use + # the remember tokens to sign in. + def User.hash(token) + Digest::SHA1.hexdigest(token.to_s) + end + + ## + # SHA-1 (Secure Hash Algorithm) is a US engineered hash + # function that produces a 20 byte hash value which typically + # forms a hexadecimal number 40 digits long. + # The reason I am not using the Bcrypt algorithm is because + # SHA-1 is much faster and I will be calling this on + # every page a user accesses. + # + # https://en.wikipedia.org/wiki/SHA-1 -=begin - -SHA-1 (Secure Hash Algorithm) is a US engineered hash -function that produces a 20 byte hash value which typically -forms a hexadecimal number 40 digits long. -The reason I am not using the Bcrypt algorithm is because -SHA-1 is much faster and I will be calling this on -every page a user accesses. - -https://en.wikipedia.org/wiki/SHA-1 - -=end # Everything under private is hidden so you cannot call. private -=begin - - Create_remember_token in order to ensure a user always has - a remember token. - -=end - def create_remember_token - self.remember_token = User.hash(User.new_remember_token) - end - -=begin - -In order to ensure that someone did not accidently submit -two accounts rapidly (which would throw off the validates -for user_name and email), I added an index to the Users -email and user_name in the database to ensure uniqueness -This also gives and index to the user_name and email -so finding a user SHOULD be easier for the database. - -=end - + ## + # Create_remember_token in order to ensure a user always has + # a remember token. + def create_remember_token + self.remember_token = User.hash(User.new_remember_token) + end + + ## + # In order to ensure that someone did not accidently submit + # two accounts rapidly (which would throw off the validates + # for user_name and email), I added an index to the Users + # email and user_name in the database to ensure uniqueness + # This also gives and index to the user_name and email + # so finding a user SHOULD be easier for the database. end -- cgit v1.2.3-2-g168b From 271f890f06ac94a785f3223d0c44a7fa8b9d74f7 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Mon, 3 Mar 2014 21:24:45 -0500 Subject: Log out button --- app/models/game.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'app/models') diff --git a/app/models/game.rb b/app/models/game.rb index b3b6977..a181c26 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -1,3 +1,2 @@ class Game < ActiveRecord::Base - has_many :game_attributes end -- cgit v1.2.3-2-g168b From 1cc839ab908ea1227e32f183609e86cedb3248fb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 11:52:10 -0500 Subject: fix typos in comments --- app/models/user.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/models') diff --git a/app/models/user.rb b/app/models/user.rb index a4fafa0..23caf84 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,13 +12,13 @@ class User < ActiveRecord::Base before_create :create_remember_token ## - # VAILD_EMAIL is the regex used to valid a user given email. + # VAILD_EMAIL is the regex used to validate a user given email. # # A break down of the regex is listed below. # # / -------------> Start of the regex # \A ------------> match start of a string - # [\w+\-.]+ -----> at least one owrd character, plus, hyphen, + # [\w+\-.]+ -----> at least one word character, plus, hyphen, # or dot # @ -------------> literal ampersand # [a-z\d\-.]+ ---> at least one letter, digit, hyphen, or dot @@ -26,7 +26,7 @@ class User < ActiveRecord::Base # does not occur # \z ------------> match end of a string # / -------------> end of the regex - # i -------------> case insensative + # i -------------> case insensitive VALID_EMAIL_REG = /\A[\w+\-.]+@[a-z\d\-.]+(?:\.[a-z]+)\z/i ## @@ -35,11 +35,11 @@ class User < ActiveRecord::Base VALID_USER_NAME_REG = /[a-zA-Z0-9\-]/ ## - # The following lines put a user accout through a series of + # The following lines put a user account through a series of # validations in order to make sure all of their information # is in the proper format. # - # validates :symbol_to_be_valided + # validates :symbol_to_be_validated # # - presence: determines whether or not a symbol is filled or not # - length: ensures there is a length limit on the symbol @@ -56,7 +56,7 @@ class User < ActiveRecord::Base ## # Instead of adding password and password_confirmation # attributes, requiring the presence of a password, - # requirin that pw and pw_com match, and add an authenticate + # requiring that pw and pw_com match, and add an authenticate # method to compare an encrypted password to the # password_digest to authenticate users, I can just add # has_secure_password which does all of this for me. @@ -84,7 +84,7 @@ class User < ActiveRecord::Base # the database. # # The reasoning for storing a hashed token is so that even if - # the database is compromised, the atacker won't be able to use + # the database is compromised, the attacker won't be able to use # the remember tokens to sign in. def User.hash(token) Digest::SHA1.hexdigest(token.to_s) @@ -112,7 +112,7 @@ class User < ActiveRecord::Base end ## - # In order to ensure that someone did not accidently submit + # In order to ensure that someone did not accidentally submit # two accounts rapidly (which would throw off the validates # for user_name and email), I added an index to the Users # email and user_name in the database to ensure uniqueness -- cgit v1.2.3-2-g168b From ba0b145820b29719e6bc9724d9d91682e4118686 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 15:29:16 -0500 Subject: foo --- app/models/game.rb | 1 + app/models/user.rb | 18 ++---------------- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'app/models') diff --git a/app/models/game.rb b/app/models/game.rb index a181c26..b3b6977 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -1,2 +1,3 @@ class Game < ActiveRecord::Base + has_many :game_attributes end diff --git a/app/models/user.rb b/app/models/user.rb index 23caf84..bd96223 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,26 +13,12 @@ class User < ActiveRecord::Base ## # VAILD_EMAIL is the regex used to validate a user given email. - # - # A break down of the regex is listed below. - # - # / -------------> Start of the regex - # \A ------------> match start of a string - # [\w+\-.]+ -----> at least one word character, plus, hyphen, - # or dot - # @ -------------> literal ampersand - # [a-z\d\-.]+ ---> at least one letter, digit, hyphen, or dot - # (?:\.[a-z]+) --> ensures that the error of example@foo..com - # does not occur - # \z ------------> match end of a string - # / -------------> end of the regex - # i -------------> case insensitive - VALID_EMAIL_REG = /\A[\w+\-.]+@[a-z\d\-.]+(?:\.[a-z]+)\z/i + VALID_EMAIL_REG = /^\S+@\S+\.\S+$/i ## # VALID_USER_NAME checks to make sure a user's user_name # is in the proper format. - VALID_USER_NAME_REG = /[a-zA-Z0-9\-]/ + VALID_USER_NAME_REG = /^[a-zA-Z0-9\-]+$/ ## # The following lines put a user account through a series of -- cgit v1.2.3-2-g168b From 89cf8c1bf9b528b739794071cc035121fa962c1a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 15:56:16 -0500 Subject: oops --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/user.rb b/app/models/user.rb index bd96223..55ea60f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,12 +13,12 @@ class User < ActiveRecord::Base ## # VAILD_EMAIL is the regex used to validate a user given email. - VALID_EMAIL_REG = /^\S+@\S+\.\S+$/i + VALID_EMAIL_REG = /\A\S+@\S+\.\S+\z/i ## # VALID_USER_NAME checks to make sure a user's user_name # is in the proper format. - VALID_USER_NAME_REG = /^[a-zA-Z0-9\-]+$/ + VALID_USER_NAME_REG = /\A[a-zA-Z0-9\-]+\z/ ## # The following lines put a user account through a series of -- cgit v1.2.3-2-g168b