~fnux/mailadmin

64e9267fab43ab0b3e1cc1aaed740ad65e1c1a60 — Timothée Floure 5 years ago b7f9226
Update dependencies
4 files changed, 29 insertions(+), 24 deletions(-)

M Gemfile.lock
M README.md
M config.example.yml
M lib/helpers.rb
M Gemfile.lock => Gemfile.lock +21 -19
@@ 3,41 3,43 @@ GEM
  specs:
    autorake (2.7)
      rake (~> 11)
    backports (3.6.8)
    backports (3.8.0)
    multi_json (1.12.1)
    mustermann (1.0.0)
    mysql (2.9.1)
    pgsql (1.3)
      autorake (>= 2.0)
    rack (1.6.4)
    rack-protection (1.5.3)
    rack (2.0.3)
    rack-protection (2.0.0)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rake (11.2.2)
    sequel (4.37.0)
    sinatra (1.4.7)
      rack (~> 1.5)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    sinatra-contrib (1.4.7)
    rake (11.3.0)
    sequel (4.48.0)
    sinatra (2.0.0)
      mustermann (~> 1.0)
      rack (~> 2.0)
      rack-protection (= 2.0.0)
      tilt (~> 2.0)
    sinatra-contrib (2.0.0)
      backports (>= 2.0)
      multi_json
      rack-protection
      rack-test
      sinatra (~> 1.4.0)
      mustermann (~> 1.0)
      rack-protection (= 2.0.0)
      sinatra (= 2.0.0)
      tilt (>= 1.3, < 3)
    sqlite3 (1.3.11)
    tilt (2.0.5)
    sqlite3 (1.3.13)
    tilt (2.0.7)

PLATFORMS
  ruby

DEPENDENCIES
  mysql
  pgsql
  rack (~> 1.6.4)
  rack
  sequel
  sinatra
  sinatra-contrib
  sqlite3

BUNDLED WITH
   1.12.5
   1.13.7

M README.md => README.md +3 -3
@@ 24,18 24,18 @@ rackup # for development, take a look to thin or unicorn for production
```
-- Database initialization
CREATE TABLE domains(
  id INT PRIMARY KEY NOT NULL,
  id INTEGER PRIMARY KEY NOT NULL,
  name CHAR(50) NOT NULL
);

CREATE TABLE users(
  id INT PRIMARY KEY NOT NULL,
  id INTEGER PRIMARY KEY NOT NULL,
  mail CHAR(50) NOT NULL,
  password CHAR(50) NOT NULL
);

CREATE TABLE aliases(
  id INT PRIMARY KEY NOT NULL,
  id INTEGER PRIMARY KEY NOT NULL,
  source CHAR(50) NOT NULL,
  destination CHAR(50) NOT NULL
);

M config.example.yml => config.example.yml +3 -0
@@ 4,6 4,9 @@ admins: admin1@lamb.da;admin2@lamb.da
# Session secret
secret: myawesomesecret

# Password encryption (SHA-512) salt
salt: ""

# Database configuration
database:
   adapter: sqlite3 # postgres, mysql

M lib/helpers.rb => lib/helpers.rb +2 -2
@@ 10,7 10,7 @@ module SessionHelpers

  # Protect a page
  def protected!(admin_required)
    if signed_in? && (!admin_required || is_admin?(session_user))
    if signed_in? && (!admin_required || is_admin?(get_session_user))
      true
    else
      redirect '/'


@@ 38,7 38,7 @@ module SessionHelpers
  # Check user IDs
  def check_user(mail, password)
    user = User.where(:mail => mail).first
    if !user.nil? && user.password == params[:password].crypt('$6$' + CONFIG['salt'])
    if !user.nil? && user.password == password.crypt('$6$' + CONFIG['salt'])
      true
    else
      false