Skip to content

Instantly share code, notes, and snippets.

View kelhusseiny's full-sized avatar
🤡
How about another joke, Murray?

Karim El-Husseiny kelhusseiny

🤡
How about another joke, Murray?
View GitHub Profile
salt= Digest::SHA1.hexdigest("# We add {email} as unique value and #{Time.now} as random value")
encrypted_password= Digest::SHA1.hexdigest("Adding #{salt} to {password}")
require 'digest/sha1'
encrypted_password= Digest::SHA1.hexdigest(password)
$ rake db:create
$ rake db:migrate
before_filter :save_login_state, :only => [:new, :create]
match ':controller(/:action(/:id))(.:format)'
attr_accessible :username, :email, :password, :password_confirmation
salt = BCrypt::Engine.generate_salt
encrypted_password = BCrypt::Engine.hash_secret(password, salt)
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "You signed up successfully"
flash[:color]= "valid"
else