basic-initial-rails4 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/controllers/users_controller.rb +7 -5
- data/app/views/sessions/new.html.haml +9 -9
- data/app/views/users/new.html.haml +3 -2
- data/lib/basic/initial/rails4/version.rb +1 -1
- data/lib/generators/binstall/binstall_generator.rb +8 -13
- metadata +2 -2
@@ -6,12 +6,14 @@ class UsersController < ApplicationController
|
|
6
6
|
|
7
7
|
def create
|
8
8
|
if params[:commit] === 'Sign in'
|
9
|
-
$user = User.find_by_email(params[:
|
10
|
-
if $user and user.authenticate(params[:
|
9
|
+
$user = User.find_by_email(params[:email])
|
10
|
+
if $user and $user.authenticate(params[:password])
|
11
11
|
session[:user_id] = $user.id
|
12
|
-
redirect_to root_path,
|
12
|
+
redirect_to root_path,
|
13
|
+
notice: 'Sign in successfully'
|
13
14
|
else
|
14
|
-
redirect_to sessions_new_path,
|
15
|
+
redirect_to sessions_new_path,
|
16
|
+
notice: 'User or password error'
|
15
17
|
end
|
16
18
|
else
|
17
19
|
redirect_to sessions_new_path
|
@@ -20,7 +22,7 @@ class UsersController < ApplicationController
|
|
20
22
|
|
21
23
|
def new
|
22
24
|
redirect_to root_path unless session[:user_id].nil?
|
23
|
-
|
25
|
+
@user = $user unless $user.nil?
|
24
26
|
$user = nil
|
25
27
|
end
|
26
28
|
end
|
@@ -7,25 +7,25 @@
|
|
7
7
|
= link_to 'Linked_in', '/auth/linked_in' unless @init_linkedin.nil?
|
8
8
|
%h1 Sign in
|
9
9
|
%p Put you information to login
|
10
|
-
=
|
10
|
+
= form_tag users_path, method: 'POST' do |f|
|
11
11
|
%table{width: '25%'}
|
12
12
|
%tr
|
13
13
|
%td
|
14
|
-
=
|
14
|
+
= label_tag :email, 'You user email'
|
15
15
|
%td
|
16
|
-
=
|
16
|
+
= text_field_tag :email
|
17
17
|
%tr
|
18
18
|
%td
|
19
|
-
=
|
19
|
+
= label_tag :password, 'Password'
|
20
20
|
%td
|
21
|
-
=
|
21
|
+
= password_field_tag :password
|
22
22
|
%tr
|
23
23
|
%td
|
24
|
-
=
|
24
|
+
= label_tag :password_confirmation, 'Password Confirmation'
|
25
25
|
%td
|
26
|
-
=
|
26
|
+
= password_field_tag :password_confirmation
|
27
27
|
%tr
|
28
28
|
%td
|
29
|
-
=
|
29
|
+
= submit_tag 'Sign in'
|
30
30
|
%td
|
31
|
-
=
|
31
|
+
= submit_tag 'Cancel'
|
@@ -25,19 +25,7 @@ class BinstallGenerator < Rails::Generators::Base
|
|
25
25
|
create_file 'app/notifier/mail_method.html.rb'
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
inject_into_file 'app/helpers/application_helper.rb', after: 'module ApplicationHelper' do
|
30
|
-
"\n def is_login!
|
31
|
-
if session[:user_id].nil?
|
32
|
-
redirect_to sessions_new_path, notice: 'You need login to load this section'
|
33
|
-
elsif $current_user.nil?
|
34
|
-
$current_user = User.find_by_id(session[:user_id])
|
35
|
-
end
|
36
|
-
end"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def load_initial_link_ban
|
28
|
+
def load_initial_necessary
|
41
29
|
inject_into_file 'app/controllers/application_controller.rb', after: 'protect_from_forgery with: :exception' do
|
42
30
|
"\n before_filter :load_initial\n
|
43
31
|
def load_initial
|
@@ -45,6 +33,13 @@ class BinstallGenerator < Rails::Generators::Base
|
|
45
33
|
@init_github = nil
|
46
34
|
@init_facebook = nil
|
47
35
|
@init_linkedin = nil
|
36
|
+
end\n
|
37
|
+
def is_login!
|
38
|
+
if session[:user_id].nil?
|
39
|
+
redirect_to sessions_new_path, notice: 'You need login to load this section'
|
40
|
+
elsif $current_user.nil?
|
41
|
+
$current_user = User.find_by_id(session[:user_id])
|
42
|
+
end
|
48
43
|
end"
|
49
44
|
end
|
50
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basic-initial-rails4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|