-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created user model, started working on authentication
- Loading branch information
Showing
20 changed files
with
272 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
source 'https://rubygems.org' | ||
|
||
|
||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
gem 'rails', '4.2.1' | ||
|
||
# Development gems | ||
group :development do | ||
# Use sqlite3 as a development database | ||
gem 'sqlite3' | ||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
# gem 'tzinfo-data', platforms: [:mingw, :mswin] | ||
end | ||
|
||
# production gems | ||
group :production do | ||
gem 'pg' | ||
end | ||
|
||
# Use carrierwave for the product image handling | ||
# gem 'carrierwave' | ||
|
||
# Use jquery as the JavaScript library | ||
gem 'jquery-rails' | ||
|
||
# Use ActiveModel has_secure_password | ||
gem 'bcrypt', '~> 3.1.7' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actionmailer (4.2.1) | ||
actionpack (= 4.2.1) | ||
actionview (= 4.2.1) | ||
activejob (= 4.2.1) | ||
mail (~> 2.5, >= 2.5.4) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
actionpack (4.2.1) | ||
actionview (= 4.2.1) | ||
activesupport (= 4.2.1) | ||
rack (~> 1.6) | ||
rack-test (~> 0.6.2) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.1) | ||
actionview (4.2.1) | ||
activesupport (= 4.2.1) | ||
builder (~> 3.1) | ||
erubis (~> 2.7.0) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.1) | ||
activejob (4.2.1) | ||
activesupport (= 4.2.1) | ||
globalid (>= 0.3.0) | ||
activemodel (4.2.1) | ||
activesupport (= 4.2.1) | ||
builder (~> 3.1) | ||
activerecord (4.2.1) | ||
activemodel (= 4.2.1) | ||
activesupport (= 4.2.1) | ||
arel (~> 6.0) | ||
activesupport (4.2.1) | ||
i18n (~> 0.7) | ||
json (~> 1.7, >= 1.7.7) | ||
minitest (~> 5.1) | ||
thread_safe (~> 0.3, >= 0.3.4) | ||
tzinfo (~> 1.1) | ||
arel (6.0.1) | ||
bcrypt (3.1.10) | ||
bcrypt (3.1.10-x86-mingw32) | ||
builder (3.2.2) | ||
erubis (2.7.0) | ||
globalid (0.3.5) | ||
activesupport (>= 4.1.0) | ||
i18n (0.7.0) | ||
jquery-rails (4.0.4) | ||
rails-dom-testing (~> 1.0) | ||
railties (>= 4.2.0) | ||
thor (>= 0.14, < 2.0) | ||
json (1.8.3) | ||
loofah (2.0.2) | ||
nokogiri (>= 1.5.9) | ||
mail (2.6.3) | ||
mime-types (>= 1.16, < 3) | ||
mime-types (2.6.1) | ||
mini_portile (0.6.2) | ||
minitest (5.7.0) | ||
nokogiri (1.6.6.2) | ||
mini_portile (~> 0.6.0) | ||
nokogiri (1.6.6.2-x86-mingw32) | ||
mini_portile (~> 0.6.0) | ||
pg (0.18.2) | ||
pg (0.18.2-x86-mingw32) | ||
rack (1.6.4) | ||
rack-test (0.6.3) | ||
rack (>= 1.0) | ||
rails (4.2.1) | ||
actionmailer (= 4.2.1) | ||
actionpack (= 4.2.1) | ||
actionview (= 4.2.1) | ||
activejob (= 4.2.1) | ||
activemodel (= 4.2.1) | ||
activerecord (= 4.2.1) | ||
activesupport (= 4.2.1) | ||
bundler (>= 1.3.0, < 2.0) | ||
railties (= 4.2.1) | ||
sprockets-rails | ||
rails-deprecated_sanitizer (1.0.3) | ||
activesupport (>= 4.2.0.alpha) | ||
rails-dom-testing (1.0.6) | ||
activesupport (>= 4.2.0.beta, < 5.0) | ||
nokogiri (~> 1.6.0) | ||
rails-deprecated_sanitizer (>= 1.0.1) | ||
rails-html-sanitizer (1.0.2) | ||
loofah (~> 2.0) | ||
railties (4.2.1) | ||
actionpack (= 4.2.1) | ||
activesupport (= 4.2.1) | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
rake (10.4.2) | ||
sprockets (3.2.0) | ||
rack (~> 1.0) | ||
sprockets-rails (2.3.2) | ||
actionpack (>= 3.0) | ||
activesupport (>= 3.0) | ||
sprockets (>= 2.8, < 4.0) | ||
sqlite3 (1.3.10) | ||
sqlite3 (1.3.10-x86-mingw32) | ||
thor (0.19.1) | ||
thread_safe (0.3.5) | ||
tzinfo (1.2.2) | ||
thread_safe (~> 0.1) | ||
|
||
PLATFORMS | ||
ruby | ||
x86-mingw32 | ||
|
||
DEPENDENCIES | ||
bcrypt (~> 3.1.7) | ||
jquery-rails | ||
pg | ||
rails (= 4.2.1) | ||
sqlite3 | ||
|
||
BUNDLED WITH | ||
1.10.6 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
Place all the styles related to the matching controller here. | ||
They will automatically be included in application.css. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class AccessController < ApplicationController | ||
|
||
def login | ||
end | ||
|
||
def logout | ||
session[:user_id] = nil | ||
redirect_to :controller => :application | ||
end | ||
|
||
private | ||
|
||
def attempt_login | ||
user = User.find_by_username(params[:username]) | ||
if user && user.authenticate(params[:password]) | ||
session[:user_id] = user.id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class AdminController < ApplicationController | ||
|
||
def | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,10 @@ def index | |
|
||
end | ||
|
||
private | ||
|
||
def logged_in | ||
session[:user_id] != nil | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AccessHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class User < ActiveRecord::Base | ||
|
||
has_secure_password | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateUsers < ActiveRecord::Migration | ||
def change | ||
create_table :users do |t| | ||
t.string :username | ||
t.string :password_digest | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# encoding: UTF-8 | ||
# This file is auto-generated from the current state of the database. Instead | ||
# of editing this file, please use the migrations feature of Active Record to | ||
# incrementally modify your database, and then regenerate this schema definition. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended that you check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(version: 20150819225504) do | ||
|
||
create_table "users", force: :cascade do |t| | ||
t.string "username" | ||
t.string "password_digest" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class AccessControllerTest < ActionController::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
# This model initially had no columns defined. If you add columns to the | ||
# model remove the '{}' from the fixture names and add the columns immediately | ||
# below each fixture, per the syntax in the comments below | ||
# | ||
one: {} | ||
# column: value | ||
# | ||
two: {} | ||
# column: value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class UserTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |