authorizme 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -81
- data/CHANGELOG.md +9 -0
- data/README.md +7 -1
- data/app/controllers/authorizme/authorizme_controller.rb +2 -6
- data/app/controllers/authorizme/password_resets_controller.rb +33 -0
- data/app/controllers/authorizme/sessions_controller.rb +2 -11
- data/app/controllers/authorizme/users_controller.rb +1 -0
- data/app/views/authorizme/authorizme/index.html.erb +6 -2
- data/app/views/authorizme/authorizme/popup.html.erb +3 -1
- data/app/views/authorizme/layouts/popup.html.erb +11 -9
- data/app/views/authorizme/password_resets/edit.html.erb +50 -0
- data/app/views/authorizme/password_resets/new.html.erb +19 -0
- data/authorizme.gemspec +1 -1
- data/{lib → config}/.DS_Store +0 -0
- data/config/locales/authorizme.en.yml +7 -0
- data/config/locales/authorizme.et.yml +7 -0
- data/config/locales/authorizme.lv.yml +7 -0
- data/config/routes.rb +1 -0
- data/lib/assets/stylesheets/authorizme.css +12 -0
- data/lib/assets/stylesheets/authorizme/button.css.scss +129 -0
- data/lib/assets/stylesheets/authorizme/form.css.scss +82 -0
- data/lib/assets/stylesheets/authorizme/main.css.scss +11 -0
- data/lib/assets/stylesheets/authorizme/popup.css.scss +65 -0
- data/lib/authorizme.rb +0 -3
- data/lib/authorizme/acts_as_authorizme.rb +30 -3
- data/lib/authorizme/for_controllers.rb +3 -7
- data/lib/authorizme/version.rb +1 -1
- data/lib/generators/authorizme/templates/authorizme.rb.erb +0 -8
- data/lib/generators/authorizme/templates/migrations/1_create_users.rb +4 -0
- data/spec/authorizme_spec.rb +1 -1
- metadata +126 -36
- data/.DS_Store +0 -0
data/.rvmrc
CHANGED
@@ -1,81 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
-
environment_id="ruby-1.9.3-p125@rails32"
|
8
|
-
|
9
|
-
#
|
10
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
11
|
-
#
|
12
|
-
# rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
|
13
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
-
# return 1
|
16
|
-
# }
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
# Uncomment following line if you want options to be set only for given project.
|
21
|
-
#
|
22
|
-
# PROJECT_JRUBY_OPTS=( --1.9 )
|
23
|
-
#
|
24
|
-
# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
|
25
|
-
#
|
26
|
-
# chmod +x ${rvm_path}/hooks/after_use_jruby_opts
|
27
|
-
#
|
28
|
-
|
29
|
-
#
|
30
|
-
# First we attempt to load the desired environment directly from the environment
|
31
|
-
# file. This is very fast and efficient compared to running through the entire
|
32
|
-
# CLI and selector. If you want feedback on which environment was used then
|
33
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
34
|
-
#
|
35
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
36
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
37
|
-
then
|
38
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
39
|
-
|
40
|
-
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
41
|
-
then
|
42
|
-
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
43
|
-
fi
|
44
|
-
else
|
45
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
46
|
-
if ! rvm --create use "$environment_id"
|
47
|
-
then
|
48
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
49
|
-
return 1
|
50
|
-
fi
|
51
|
-
fi
|
52
|
-
|
53
|
-
#
|
54
|
-
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
55
|
-
# it be automatically loaded. Uncomment the following and adjust the filename if
|
56
|
-
# necessary.
|
57
|
-
#
|
58
|
-
# filename=".gems"
|
59
|
-
# if [[ -s "$filename" ]]
|
60
|
-
# then
|
61
|
-
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
62
|
-
# fi
|
63
|
-
|
64
|
-
# If you use bundler, this might be useful to you:
|
65
|
-
# if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
|
66
|
-
# then
|
67
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
68
|
-
# gem install bundler
|
69
|
-
# fi
|
70
|
-
# if [[ -s Gemfile ]] && command -v bundle
|
71
|
-
# then
|
72
|
-
# bundle install
|
73
|
-
# fi
|
74
|
-
|
75
|
-
if [[ $- == *i* ]] # check for interactive shells
|
76
|
-
then
|
77
|
-
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
78
|
-
else
|
79
|
-
echo "Using: $GEM_HOME" # don't use colors in interactive shells
|
80
|
-
fi
|
81
|
-
|
1
|
+
rvm 1.9.3@authorizme --verbose --create
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -58,7 +58,9 @@ By default providers use callback view which require JQuery and require `eventBu
|
|
58
58
|
<script type="text/javascript">
|
59
59
|
$(document).ready(function() {
|
60
60
|
window.close();
|
61
|
-
|
61
|
+
if (window.opener.eventBus) {
|
62
|
+
window.opener.eventBus.trigger("loginDone");
|
63
|
+
}
|
62
64
|
window.opener.focus();
|
63
65
|
});
|
64
66
|
</script>
|
@@ -73,6 +75,10 @@ You can implement your own provider:
|
|
73
75
|
2. You must implement `auth` and `callback` methods, where `auth` is method which redirect user to provider and `callback` get data from provider callback data.
|
74
76
|
3. Then you must add your provider namespace in authorizme config file in array `providers`.
|
75
77
|
|
78
|
+
#### Password reset
|
79
|
+
|
80
|
+
Use `/authorizme/password_resets` (if you have another namespace, use `/{your_namespace}/password_resets`) controller to create a password reset token and send it to user. You can overide `send_password_reset_notification` method in user model to send an email with `password_reset_token` . The password reset token will expire after 2 hours.
|
81
|
+
|
76
82
|
## Development
|
77
83
|
|
78
84
|
Questions or problems? Please post them on the [issue tracker](https://github.com/CreativeMobile/authorizme/issues). You can contribute changes by forking the project and submitting a pull request. You can ensure the tests passing by running `bundle` and `rake`.
|
@@ -17,12 +17,8 @@ module Authorizme
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def logout
|
20
|
-
session[:user_id] = nil
|
21
|
-
|
22
|
-
respond_with_status "logged_out"
|
23
|
-
else
|
24
|
-
redirect_to Authorizme::after_logout_path
|
25
|
-
end
|
20
|
+
session[:user_id] = nil if session[:user_id] && session[:user_id] != nil
|
21
|
+
respond_with({status: "logged_out"}, :location => Authorizme::after_logout_path)
|
26
22
|
end
|
27
23
|
|
28
24
|
def render_popup_view
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Authorizme
|
2
|
+
class PasswordResetsController < AuthorizmeController
|
3
|
+
def new
|
4
|
+
end
|
5
|
+
|
6
|
+
def create
|
7
|
+
user = User.find_by_email(params[:email])
|
8
|
+
user.send_password_reset if user
|
9
|
+
if user
|
10
|
+
respond_with user, :location => root_url
|
11
|
+
else
|
12
|
+
respond_with nil, :location => root_url
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@user = User.find_by_password_reset_token!(params[:id])
|
18
|
+
end
|
19
|
+
|
20
|
+
def update
|
21
|
+
@user = User.find_by_password_reset_token!(params[:id])
|
22
|
+
@user.password_will_be_update_in_this_request if @user
|
23
|
+
if @user.password_reset_sent_at < 2.hours.ago
|
24
|
+
respond_with @user, :location => root_url, :alert => "Password reset has expired."
|
25
|
+
elsif @user.update_attributes(params[:user])
|
26
|
+
login @user
|
27
|
+
respond_with @user, :location => root_url, :notice => "Password has been reset!"
|
28
|
+
else
|
29
|
+
render :edit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -5,18 +5,9 @@ module Authorizme
|
|
5
5
|
user = User.find_by_email(params[:email])
|
6
6
|
if user && user.authenticate(params[:password])
|
7
7
|
login user
|
8
|
-
|
9
|
-
respond_with_status "logged_in", {user: user}
|
10
|
-
else
|
11
|
-
redirect_to Authorizme::after_login_path
|
12
|
-
end
|
8
|
+
respond_with({status: "logged_in", user: user}, :location => Authorizme::after_login_path)
|
13
9
|
else
|
14
|
-
|
15
|
-
status = {status: "authorization_faild"}
|
16
|
-
respond_with(status, {:location => nil, :status => :not_found})
|
17
|
-
else
|
18
|
-
render "new"
|
19
|
-
end
|
10
|
+
respond_with({status: "authorization_faild", user: user}, {:location => Authorizme::not_logged_in_path, :status => :not_found})
|
20
11
|
end
|
21
12
|
end
|
22
13
|
|
@@ -11,9 +11,11 @@
|
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
<div
|
14
|
+
<div>
|
15
|
+
<%= link_to "logout", "/#{Authorizme::namespace}/logout", :method => :delete %>
|
16
|
+
</div>
|
15
17
|
|
16
|
-
<% end %>
|
18
|
+
<% end %>
|
17
19
|
|
18
20
|
|
19
21
|
|
@@ -30,6 +32,8 @@
|
|
30
32
|
<p class="button"><%= submit_tag "Log in" %></p>
|
31
33
|
<% end %>
|
32
34
|
|
35
|
+
<%= link_to "Forget your password?", "/#{Authorizme::namespace}/password_resets/new" %>
|
36
|
+
|
33
37
|
<h3>or use one of those providers:</h3>
|
34
38
|
<%= link_to "Draugiem.lv", "/#{Authorizme::namespace}/login/draugiem" %>
|
35
39
|
<%= link_to "Twitter.com", "/#{Authorizme::namespace}/login/twitter" %>
|
@@ -1,11 +1,13 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
<head>
|
4
|
+
<title>Authorizme</title>
|
5
|
+
<%= stylesheet_link_tag "authorizme", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "jquery" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body>
|
11
|
+
<%= yield %>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<div id="popups">
|
2
|
+
<div class="popup_wrap">
|
3
|
+
<div class="shade_wrap"></div>
|
4
|
+
<div class="container_wrap">
|
5
|
+
|
6
|
+
<h2><%= t("authorizme.password_reset.new_password_form.title") %></h2>
|
7
|
+
<p><%= t("authorizme.password_reset.new_password_form.description") %></p>
|
8
|
+
|
9
|
+
<%= form_for @user, :url => "/#{Authorizme::namespace}/password_resets/#{params[:id]}" do |f| %>
|
10
|
+
|
11
|
+
<% if @user.errors.any? && @user.errors.get(:password) %>
|
12
|
+
<div class="error_messages">
|
13
|
+
<ul>
|
14
|
+
<% @user.errors.get(:password).each do |error| %>
|
15
|
+
<li><%= error %></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<div class="field">
|
22
|
+
<%= f.label :password %>
|
23
|
+
<%= f.password_field :password %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<% if @user.errors.any? && @user.errors.get(:password_confirmation) %>
|
27
|
+
<div class="error_messages">
|
28
|
+
<ul>
|
29
|
+
<% @user.errors.get(:password_confirmation).each do |error| %>
|
30
|
+
<li><%= error %></li>
|
31
|
+
<% end %>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :password_confirmation %>
|
38
|
+
<%= f.password_field :password_confirmation %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="actions">
|
42
|
+
<div class="button_wrap center green">
|
43
|
+
<%= f.submit t("authorizme.password_reset.new_password_form.submit") %>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div id="popups">
|
2
|
+
<div class="popup_wrap">
|
3
|
+
<div class="shade_wrap"></div>
|
4
|
+
<div class="container_wrap">
|
5
|
+
|
6
|
+
<h2>Password reset</h2>
|
7
|
+
<p>Please, enter your e-mail</p>
|
8
|
+
|
9
|
+
<%= form_tag authorizme_password_resets_path, :method => :post do %>
|
10
|
+
<div class="field">
|
11
|
+
<%= label_tag :email %>
|
12
|
+
<%= text_field_tag :email, params[:email] %>
|
13
|
+
</div>
|
14
|
+
<div class="actions"><%= submit_tag "Reset Password" %></div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
data/authorizme.gemspec
CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency 'capybara'
|
26
26
|
s.add_development_dependency 'factory_girl_rails'
|
27
27
|
|
28
|
-
s.add_dependency "activesupport"
|
29
28
|
s.add_dependency "rails"
|
29
|
+
s.add_dependency "activesupport"
|
30
30
|
s.add_dependency "bcrypt-ruby"
|
31
31
|
s.add_dependency "json"
|
32
32
|
s.add_dependency "twitter_oauth"
|
data/{lib → config}/.DS_Store
RENAMED
Binary file
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
.button_wrap
|
4
|
+
{
|
5
|
+
input
|
6
|
+
{
|
7
|
+
display: block;
|
8
|
+
padding: 10px 18px;
|
9
|
+
position: relative;
|
10
|
+
top: -1px;
|
11
|
+
left: -1px;
|
12
|
+
border-radius: 3px;
|
13
|
+
-moz-border-radius: 3px;
|
14
|
+
-webkit-border-radius: 3px;
|
15
|
+
cursor: pointer;
|
16
|
+
line-height: 16px;
|
17
|
+
border: none;
|
18
|
+
color: #363636;
|
19
|
+
box-shadow: inset 0 -8px 10px rgba(0,0,0,0.15), 0 1px 0 rgba(255,255,255, 0.3), inset 0 1px 0 rgba(255,255,255, 0.3);
|
20
|
+
-webkit-transition: background 0.2s ease;
|
21
|
+
-moz-transition: background 0.2s ease;
|
22
|
+
-o-transition: background 0.2s ease;
|
23
|
+
-ms-transition: background 0.2s ease;
|
24
|
+
transition: background 0.2s ease;
|
25
|
+
-webkit-font-smoothing: antialiased;
|
26
|
+
-webkit-text-shadow: 1px 1px 0 #fff;
|
27
|
+
-moz-text-shadow: 1px 1px 0 #fff;
|
28
|
+
text-shadow: 1px 1px 0 #fff;
|
29
|
+
font:
|
30
|
+
{
|
31
|
+
weight: bold;
|
32
|
+
size: 12px;
|
33
|
+
}
|
34
|
+
|
35
|
+
&:active
|
36
|
+
{
|
37
|
+
-webkit-box-shadow: 1px 1px 2px #aaa inset;
|
38
|
+
-moz-box-shadow: 1px 1px 2px #aaa inset;
|
39
|
+
-o-box-shadow: 1px 1px 2px #aaa inset;
|
40
|
+
box-shadow: 1px 1px 2px #aaa inset;
|
41
|
+
top: 0;
|
42
|
+
left: 0;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
&.center
|
47
|
+
{
|
48
|
+
input
|
49
|
+
{
|
50
|
+
margin: 0 auto;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
&.large
|
55
|
+
{
|
56
|
+
input
|
57
|
+
{
|
58
|
+
height: 32px;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
&.grey {
|
63
|
+
&:hover {
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
input
|
68
|
+
{
|
69
|
+
background: #b5b5b5;
|
70
|
+
border: none;
|
71
|
+
color: #fff;
|
72
|
+
-webkit-text-shadow: 1px 1px 0 #808080;
|
73
|
+
-moz-text-shadow: 1px 1px 0 #808080;
|
74
|
+
text-shadow: 1px 1px 0 #808080;
|
75
|
+
|
76
|
+
|
77
|
+
&:hover
|
78
|
+
{
|
79
|
+
-webkit-text-shadow: 1px 1px 0 #808080;
|
80
|
+
-moz-text-shadow: 1px 1px 0 #808080;
|
81
|
+
text-shadow: 1px 1px 0 #808080;
|
82
|
+
background: #d0d0d0;
|
83
|
+
}
|
84
|
+
|
85
|
+
&:active
|
86
|
+
{
|
87
|
+
-webkit-box-shadow: 1px 1px 2px #808080 inset;
|
88
|
+
-moz-box-shadow: 1px 1px 2px #808080 inset;
|
89
|
+
-o-box-shadow: 1px 1px 2px #808080 inset;
|
90
|
+
box-shadow: 1px 1px 2px #808080 inset;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
&.green
|
96
|
+
{
|
97
|
+
&:hover
|
98
|
+
{
|
99
|
+
|
100
|
+
}
|
101
|
+
|
102
|
+
input
|
103
|
+
{
|
104
|
+
background: #91c508;
|
105
|
+
border: none;
|
106
|
+
color: #fff;
|
107
|
+
-webkit-text-shadow: 1px 1px 0 #628c03;
|
108
|
+
-moz-text-shadow: 1px 1px 0 #628c03;
|
109
|
+
text-shadow: 1px 1px 0 #628c03;
|
110
|
+
|
111
|
+
&:hover
|
112
|
+
{
|
113
|
+
-webkit-text-shadow: 1px 1px 0 #628c03;
|
114
|
+
-moz-text-shadow: 1px 1px 0 #628c03;
|
115
|
+
text-shadow: 1px 1px 0 #628c03;
|
116
|
+
background: #7cb009;
|
117
|
+
}
|
118
|
+
|
119
|
+
&:active
|
120
|
+
{
|
121
|
+
-webkit-box-shadow: 1px 1px 2px #688f00 inset;
|
122
|
+
-moz-box-shadow: 1px 1px 2px #688f00 inset;
|
123
|
+
-o-box-shadow: 1px 1px 2px #688f00 inset;
|
124
|
+
box-shadow: 1px 1px 2px #688f00 inset;
|
125
|
+
background: #7cb009;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
form
|
4
|
+
{
|
5
|
+
.field
|
6
|
+
{
|
7
|
+
display: block;
|
8
|
+
|
9
|
+
label
|
10
|
+
{
|
11
|
+
display: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
input
|
15
|
+
{
|
16
|
+
display: block;
|
17
|
+
width: 100%;
|
18
|
+
padding: 8px;
|
19
|
+
margin: 8px 0;
|
20
|
+
-webkit-box-sizing: border-box;
|
21
|
+
-moz-box-sizing: border-box;
|
22
|
+
box-sizing: border-box;
|
23
|
+
border: 1px solid #C2C2C2;
|
24
|
+
color: #666666;
|
25
|
+
-webkit-border-radius: 4px;
|
26
|
+
-moz-border-radius: 4px;
|
27
|
+
border-radius: 4px;
|
28
|
+
background: #FDFDFC;
|
29
|
+
font-size: 14px;
|
30
|
+
-webkit-transition: all 0.3s ease;
|
31
|
+
-moz-transition: all 0.3s ease;
|
32
|
+
-ms-transition: all 0.3s ease;
|
33
|
+
-o-transition: all 0.3s ease;
|
34
|
+
transition: all 0.3s ease;
|
35
|
+
|
36
|
+
&:focus
|
37
|
+
{
|
38
|
+
-webkit-box-shadow: 0 0 5px #d3d3d3;
|
39
|
+
-moz-box-shadow: 0 0 5px #d3d3d3;
|
40
|
+
box-shadow: 0 0 5px #d3d3d3;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
.field_with_errors
|
45
|
+
{
|
46
|
+
input
|
47
|
+
{
|
48
|
+
border: 1px solid #D60000;
|
49
|
+
margin: 4px 0 8px;
|
50
|
+
|
51
|
+
&:focus
|
52
|
+
{
|
53
|
+
-webkit-box-shadow: 0 0 5px #d39999;
|
54
|
+
-moz-box-shadow: 0 0 5px #d39999;
|
55
|
+
box-shadow: 0 0 5px #d39999;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
.error_messages
|
62
|
+
{
|
63
|
+
ul
|
64
|
+
{
|
65
|
+
list-style: none;
|
66
|
+
|
67
|
+
li
|
68
|
+
{
|
69
|
+
display: block;
|
70
|
+
color: #D60000;
|
71
|
+
font-size: 11px;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
.actions
|
77
|
+
{
|
78
|
+
display: block;
|
79
|
+
padding: 5px 0 0;
|
80
|
+
text-align: center;
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
#popups
|
4
|
+
{
|
5
|
+
display: block;
|
6
|
+
width: 100%;
|
7
|
+
height: 100%;
|
8
|
+
}
|
9
|
+
|
10
|
+
.popup_wrap
|
11
|
+
{
|
12
|
+
display: block;
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
15
|
+
position: absolute;
|
16
|
+
top: 0;
|
17
|
+
left: 0;
|
18
|
+
z-index: 1000;
|
19
|
+
|
20
|
+
.shade_wrap
|
21
|
+
{
|
22
|
+
display: block;
|
23
|
+
|
24
|
+
width: 100%;
|
25
|
+
height: 100%;
|
26
|
+
|
27
|
+
position: absolute;
|
28
|
+
top: 0;
|
29
|
+
left: 0;
|
30
|
+
|
31
|
+
background: #000;
|
32
|
+
opacity: 0.7;
|
33
|
+
}
|
34
|
+
|
35
|
+
.container_wrap
|
36
|
+
{
|
37
|
+
display: block;
|
38
|
+
|
39
|
+
min-width: 280px;
|
40
|
+
|
41
|
+
padding: 30px;
|
42
|
+
margin: 0 0 0 -170px;
|
43
|
+
|
44
|
+
position: absolute;
|
45
|
+
top: 10%;
|
46
|
+
left: 50%;
|
47
|
+
|
48
|
+
-webkit-border-radius: 6px;
|
49
|
+
-moz-border-radius: 6px;
|
50
|
+
border-radius: 6px;
|
51
|
+
|
52
|
+
background: #FDFDFD;
|
53
|
+
|
54
|
+
p
|
55
|
+
{
|
56
|
+
margin: 0 0 10px 0;
|
57
|
+
font-weight: normal;
|
58
|
+
font-size: 16px;
|
59
|
+
line-height: 20px;
|
60
|
+
color: #464646;
|
61
|
+
text-align: center;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|
data/lib/authorizme.rb
CHANGED
@@ -18,11 +18,14 @@ module Authorizme
|
|
18
18
|
has_many :synchronize_requests, :class_name => "Authorizme::SynchronizeRequest"
|
19
19
|
|
20
20
|
attr_reader :password
|
21
|
-
|
21
|
+
attr_accessor :password_will_be_update
|
22
|
+
|
23
|
+
attr_accessible :first_name, :last_name, :image_url, :email, :password, :password_confirmation, :password_will_be_update
|
22
24
|
|
23
25
|
# Validations
|
24
26
|
validates_confirmation_of :password
|
25
|
-
|
27
|
+
validates_length_of :password, :minimum => 3, :if => :need_check_password?
|
28
|
+
validates_presence_of :password_digest, :if => :has_not_provider?
|
26
29
|
validates_presence_of :email, :on => :create, :if => :has_not_provider?
|
27
30
|
validates_uniqueness_of :email, :if => :has_not_provider?
|
28
31
|
|
@@ -112,6 +115,14 @@ module Authorizme
|
|
112
115
|
def has_not_provider?
|
113
116
|
!self.has_provider
|
114
117
|
end
|
118
|
+
|
119
|
+
def need_check_password?
|
120
|
+
self.password_will_be_update
|
121
|
+
end
|
122
|
+
|
123
|
+
def password_will_be_update_in_this_request
|
124
|
+
self.password_will_be_update = true
|
125
|
+
end
|
115
126
|
|
116
127
|
def has_synchronize_request?
|
117
128
|
self.synchronize_requests.status_new.any?
|
@@ -131,8 +142,24 @@ module Authorizme
|
|
131
142
|
def on_logged_in
|
132
143
|
end
|
133
144
|
|
134
|
-
|
145
|
+
def send_password_reset
|
146
|
+
set_new_password_reset_token
|
147
|
+
self.password_reset_sent_at = Time.zone.now
|
148
|
+
self.save!
|
149
|
+
send_password_reset_notification
|
150
|
+
end
|
135
151
|
|
152
|
+
def set_new_password_reset_token
|
153
|
+
begin
|
154
|
+
self.password_reset_token = SecureRandom.urlsafe_base64
|
155
|
+
end while User.exists?(:password_reset_token => self.password_reset_token)
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
159
|
+
|
160
|
+
def send_password_reset_notification
|
161
|
+
end
|
162
|
+
|
136
163
|
def on_synchronized old_user
|
137
164
|
end
|
138
165
|
|
@@ -13,7 +13,7 @@ module Authorizme
|
|
13
13
|
|
14
14
|
def current_user
|
15
15
|
return @current_user if defined? @current_users
|
16
|
-
@current_user ||= User.find session[:user_id] if session[:user_id]
|
16
|
+
@current_user ||= User.find session[:user_id] if session[:user_id] && session[:user_id] != nil
|
17
17
|
end
|
18
18
|
|
19
19
|
def login user
|
@@ -56,12 +56,8 @@ module Authorizme
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def not_logged_in_status
|
59
|
-
|
60
|
-
|
61
|
-
respond_with status
|
62
|
-
else
|
63
|
-
redirect_to "/#{Authorizme::namespace}/"
|
64
|
-
end
|
59
|
+
status = {status: "not_logged_in"}
|
60
|
+
respond_with status, :location => "/#{Authorizme::namespace}/"
|
65
61
|
end
|
66
62
|
end
|
67
63
|
end
|
data/lib/authorizme/version.rb
CHANGED
@@ -46,14 +46,6 @@ Authorizme.setup do |config|
|
|
46
46
|
#
|
47
47
|
# Default is set authorizme
|
48
48
|
|
49
|
-
# == Authorize all remotly with ajax
|
50
|
-
#
|
51
|
-
# If application use ajax in login and logout forms then this must be set true.
|
52
|
-
#
|
53
|
-
# config.remote = false
|
54
|
-
#
|
55
|
-
# Default it is set false
|
56
|
-
|
57
49
|
# == You can specify which providers you want to use in your application
|
58
50
|
#
|
59
51
|
# You can specify which providers you want to use in your application
|
data/spec/authorizme_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorizme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: rspec
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :development
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rspec-rails
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: webrat
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: capybara
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: factory_girl_rails
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: '0'
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
83
|
-
requirement:
|
112
|
+
name: rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ! '>='
|
@@ -88,10 +118,15 @@ dependencies:
|
|
88
118
|
version: '0'
|
89
119
|
type: :runtime
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
92
127
|
- !ruby/object:Gem::Dependency
|
93
|
-
name:
|
94
|
-
requirement:
|
128
|
+
name: activesupport
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
95
130
|
none: false
|
96
131
|
requirements:
|
97
132
|
- - ! '>='
|
@@ -99,10 +134,15 @@ dependencies:
|
|
99
134
|
version: '0'
|
100
135
|
type: :runtime
|
101
136
|
prerelease: false
|
102
|
-
version_requirements:
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
103
143
|
- !ruby/object:Gem::Dependency
|
104
144
|
name: bcrypt-ruby
|
105
|
-
requirement:
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
106
146
|
none: false
|
107
147
|
requirements:
|
108
148
|
- - ! '>='
|
@@ -110,10 +150,15 @@ dependencies:
|
|
110
150
|
version: '0'
|
111
151
|
type: :runtime
|
112
152
|
prerelease: false
|
113
|
-
version_requirements:
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
114
159
|
- !ruby/object:Gem::Dependency
|
115
160
|
name: json
|
116
|
-
requirement:
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
117
162
|
none: false
|
118
163
|
requirements:
|
119
164
|
- - ! '>='
|
@@ -121,10 +166,15 @@ dependencies:
|
|
121
166
|
version: '0'
|
122
167
|
type: :runtime
|
123
168
|
prerelease: false
|
124
|
-
version_requirements:
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
125
175
|
- !ruby/object:Gem::Dependency
|
126
176
|
name: twitter_oauth
|
127
|
-
requirement:
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
128
178
|
none: false
|
129
179
|
requirements:
|
130
180
|
- - ! '>='
|
@@ -132,10 +182,15 @@ dependencies:
|
|
132
182
|
version: '0'
|
133
183
|
type: :runtime
|
134
184
|
prerelease: false
|
135
|
-
version_requirements:
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
136
191
|
- !ruby/object:Gem::Dependency
|
137
192
|
name: twitter
|
138
|
-
requirement:
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
139
194
|
none: false
|
140
195
|
requirements:
|
141
196
|
- - ! '>='
|
@@ -143,10 +198,15 @@ dependencies:
|
|
143
198
|
version: '0'
|
144
199
|
type: :runtime
|
145
200
|
prerelease: false
|
146
|
-
version_requirements:
|
201
|
+
version_requirements: !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
203
|
+
requirements:
|
204
|
+
- - ! '>='
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
147
207
|
- !ruby/object:Gem::Dependency
|
148
208
|
name: oauth2
|
149
|
-
requirement:
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
150
210
|
none: false
|
151
211
|
requirements:
|
152
212
|
- - ! '>='
|
@@ -154,10 +214,15 @@ dependencies:
|
|
154
214
|
version: '0'
|
155
215
|
type: :runtime
|
156
216
|
prerelease: false
|
157
|
-
version_requirements:
|
217
|
+
version_requirements: !ruby/object:Gem::Requirement
|
218
|
+
none: false
|
219
|
+
requirements:
|
220
|
+
- - ! '>='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
158
223
|
- !ruby/object:Gem::Dependency
|
159
224
|
name: fbgraph
|
160
|
-
requirement:
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
161
226
|
none: false
|
162
227
|
requirements:
|
163
228
|
- - ! '>='
|
@@ -165,7 +230,12 @@ dependencies:
|
|
165
230
|
version: '0'
|
166
231
|
type: :runtime
|
167
232
|
prerelease: false
|
168
|
-
version_requirements:
|
233
|
+
version_requirements: !ruby/object:Gem::Requirement
|
234
|
+
none: false
|
235
|
+
requirements:
|
236
|
+
- - ! '>='
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: '0'
|
169
239
|
description: Authorization that includes basic authorization and 3 social authorization
|
170
240
|
with Latvia social network draugiem.lv, facebook.com and twitter.com.
|
171
241
|
email:
|
@@ -174,7 +244,6 @@ executables: []
|
|
174
244
|
extensions: []
|
175
245
|
extra_rdoc_files: []
|
176
246
|
files:
|
177
|
-
- .DS_Store
|
178
247
|
- .gitignore
|
179
248
|
- .rspec
|
180
249
|
- .rvmrc
|
@@ -187,6 +256,7 @@ files:
|
|
187
256
|
- app/controllers/authorizme/login/draugiem_controller.rb
|
188
257
|
- app/controllers/authorizme/login/facebook_controller.rb
|
189
258
|
- app/controllers/authorizme/login/twitter_controller.rb
|
259
|
+
- app/controllers/authorizme/password_resets_controller.rb
|
190
260
|
- app/controllers/authorizme/sessions_controller.rb
|
191
261
|
- app/controllers/authorizme/users_controller.rb
|
192
262
|
- app/models/authorizme/synchronize_request.rb
|
@@ -197,10 +267,20 @@ files:
|
|
197
267
|
- app/views/authorizme/layouts/authorizme.html.erb
|
198
268
|
- app/views/authorizme/layouts/popup.html.erb
|
199
269
|
- app/views/authorizme/login/facebook/auth.html.erb
|
270
|
+
- app/views/authorizme/password_resets/edit.html.erb
|
271
|
+
- app/views/authorizme/password_resets/new.html.erb
|
200
272
|
- app/views/authorizme/users/new.html.erb
|
201
273
|
- authorizme.gemspec
|
274
|
+
- config/.DS_Store
|
275
|
+
- config/locales/authorizme.en.yml
|
276
|
+
- config/locales/authorizme.et.yml
|
277
|
+
- config/locales/authorizme.lv.yml
|
202
278
|
- config/routes.rb
|
203
|
-
- lib
|
279
|
+
- lib/assets/stylesheets/authorizme.css
|
280
|
+
- lib/assets/stylesheets/authorizme/button.css.scss
|
281
|
+
- lib/assets/stylesheets/authorizme/form.css.scss
|
282
|
+
- lib/assets/stylesheets/authorizme/main.css.scss
|
283
|
+
- lib/assets/stylesheets/authorizme/popup.css.scss
|
204
284
|
- lib/authorizme.rb
|
205
285
|
- lib/authorizme/.DS_Store
|
206
286
|
- lib/authorizme/acts_as_authorizme.rb
|
@@ -237,17 +317,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
317
|
- - ! '>='
|
238
318
|
- !ruby/object:Gem::Version
|
239
319
|
version: '0'
|
320
|
+
segments:
|
321
|
+
- 0
|
322
|
+
hash: -3990726868024022512
|
240
323
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
324
|
none: false
|
242
325
|
requirements:
|
243
326
|
- - ! '>='
|
244
327
|
- !ruby/object:Gem::Version
|
245
328
|
version: '0'
|
329
|
+
segments:
|
330
|
+
- 0
|
331
|
+
hash: -3990726868024022512
|
246
332
|
requirements: []
|
247
333
|
rubyforge_project: authorizme
|
248
|
-
rubygems_version: 1.8.
|
334
|
+
rubygems_version: 1.8.25
|
249
335
|
signing_key:
|
250
336
|
specification_version: 3
|
251
337
|
summary: ! 'Simple authorization gem for basic and Oauth: facebook.com, twitter.com
|
252
338
|
and draugiem.lv'
|
253
|
-
test_files:
|
339
|
+
test_files:
|
340
|
+
- spec/authorizme/providers/draugiem_spec.rb
|
341
|
+
- spec/authorizme_spec.rb
|
342
|
+
- spec/factories.rb
|
343
|
+
- spec/spec_helper.rb
|
data/.DS_Store
DELETED
Binary file
|