Removed gravatars & refactor

master
E. Almqvist 3 years ago
parent 25bc1e9201
commit 614e2009a0
  1. 1
      src/Gemfile
  2. 14
      src/app.rb
  3. 9
      src/db_models.rb
  4. 2
      src/lib/database.rb
  5. 2
      src/views/stylesheets/style.sass

@ -13,4 +13,3 @@ gem "slim"
gem "sassc" gem "sassc"
gem "colorize" gem "colorize"
gem "bcrypt" gem "bcrypt"
gem "gravatar"

@ -1,6 +1,6 @@
#!/usr/bin/ruby -w #!/usr/bin/ruby -w
DEBUG = ARGV[0] == "debug" DEBUG = ARGV[0] == "debug"
require "sinatra" require "sinatra"
require "sinatra/reloader" if DEBUG require "sinatra/reloader" if DEBUG
@ -9,7 +9,6 @@ require "sqlite3"
require "sassc" require "sassc"
require "colorize" require "colorize"
require "bcrypt" require "bcrypt"
require "gravatar"
require_relative "config.rb" require_relative "config.rb"
require_relative "debug.rb" require_relative "debug.rb"
@ -19,6 +18,12 @@ require_relative "func.rb"
require_relative "db_init.rb" require_relative "db_init.rb"
require_relative "db_models.rb" require_relative "db_models.rb"
also_reload "lib/*"
also_reload "func.rb"
also_reload "config.rb"
also_reload "db_models.rb"
also_reload "db_init.rb"
enable :sessions enable :sessions
db_init db_init
@ -71,3 +76,8 @@ post "/login" do
end end
end end
post "/logout" do
session.clear
redirect "/"
end

@ -14,12 +14,7 @@ class User < EntityModel
end end
def avatar def avatar
gravatar = nil # Gravatar.src @email return @avatar_url
if gravatar then
return gravatar
else
return @avatar_url
end
end end
# Find user by ID, returns a user object # Find user by ID, returns a user object
@ -39,7 +34,7 @@ class User < EntityModel
check_all_fields = email != "" && name != "" && password != "" && password_confirm != "" check_all_fields = email != "" && name != "" && password != "" && password_confirm != ""
# Check email # Check email
check_email_dupe = self.find_by_email(email) check_email_dupe = self.find_by_email(email) == nil
check_email_valid = email.match(EMAIL_REGEX) != nil check_email_valid = email.match(EMAIL_REGEX) != nil
# Name # Name

@ -3,7 +3,7 @@ def db
dbbuf.results_as_hash = true dbbuf.results_as_hash = true
dbbuf dbbuf
end end
class EntityModel class EntityModel
attr_reader :id, :data attr_reader :id, :data

@ -104,7 +104,7 @@ label.error_msg
font-weight: bold font-weight: bold
img.avatar img.avatar
background: $shadow_clr background: $bg_clr
width: 2.15rem width: 2.15rem
height: auto height: auto
border-radius: 50% border-radius: 50%

Loading…
Cancel
Save