class User

This class manages users in the database

Public Class Methods

admin() click to toggle source
# File lib/manband/user.rb, line 43
def self.admin
  return @@admin
end
init() click to toggle source

Creates a default admin account if it does not exists. Default password is admin

# File lib/manband/user.rb, line 23
def self.init
  admin = User.get(@@admin)
  if admin == nil
    uuid = UUID.new
    admin = User.new(:login => @@admin, :password => Digest::SHA1.hexdigest('admin'))
    admin.save
  end
end

Public Instance Methods

authenticate(password) click to toggle source

Check passwords password: user password @return: true if authentication is correct

# File lib/manband/user.rb, line 35
def authenticate(password)
  shapwd = Digest::SHA1.hexdigest(password) 
  if self.password == shapwd
    return true
  end
  return false; 
end