| View previous topic :: View next topic |
| Author |
Message |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu May 08, 2008 5:24 pm Post subject: Login |
|
|
require 'digest/sha2'
class User < ActiveRecord::Base
attr_accessor :password
has_many :events,
:dependent => :destroy
has_many :registrations,
:dependent => :destroy
has_many :activities, :through => :registrations, :source => :event
validates_presence_of :login
validates_length_of :login
validates_uniqueness_of :login
validates_format_of :login, :with => /^[\w\.-]+$/i
validates_presence_of :password, :if => :password_required?
validates_length_of :password, :within => 3...40, :if => :password_required?
validates_confirmation_of :password, :if => :password_required?
before_save :encrypt_new_password
def self.authenticate(login,password)
user = find_by_login(login)
return user if user && user.authenticated?(password)
end
def authenticated?(password)
hashed_password == encrypt(password)
end
protected
def encrypt_new_password
return if password.blank?
self.hashed_password == encrypt(password)
end
def password_required?
hashed_password.blank? || !password.blank?
end
def encrypt(string)
Digest::SHA2.hexdigest(string)
end
end
_________________
This is the inception of deception, checking the depth of your perception.

Last edited by Aviar³ on Thu May 08, 2008 5:26 pm; edited 1 time in total |
|
| Back to top |
|
 |
Localhost I post too much
Reputation: 0
Joined: 28 Apr 2007 Posts: 3402
|
Posted: Thu May 08, 2008 5:26 pm Post subject: |
|
|
PHP > Ruby on Rails
_________________
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu May 08, 2008 5:27 pm Post subject: |
|
|
Then you>idiot.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
Box Grandmaster Cheater
Reputation: 0
Joined: 16 Oct 2007 Posts: 541
|
Posted: Thu May 08, 2008 5:28 pm Post subject: |
|
|
aviar>chicken who golfs in a suit
_________________
| zurkei wrote: | | Wow box your a real dick, I can't believe I actually thought that you were telling the truth... |
Fact: no one tells the truth on cheat engine fourms |
|
| Back to top |
|
 |
Mc Nuggets Master Cheater
Reputation: 12
Joined: 20 Oct 2007 Posts: 446 Location: NOMANCHES PUTO'S BALLS
|
Posted: Thu May 08, 2008 5:29 pm Post subject: |
|
|
| aviar=win
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu May 08, 2008 5:29 pm Post subject: |
|
|
magic moo>aviar? Anyways, havent seen you before but hi. If that was meant to be offensive, I didnt quite get if you meant I am better than a chicken by the greater than sign or worse than a chicken.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
|