sinatra-authentication 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/views/edit.haml +26 -21
- data/lib/views/login.haml +11 -11
- data/lib/views/signup.haml +12 -10
- data/readme.markdown +1 -1
- data/sinatra-authentication.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
|
7
7
|
Jeweler::Tasks.new do |gemspec|
|
8
8
|
gemspec.name = 'sinatra-authentication'
|
9
|
-
gemspec.version = '0.2.
|
9
|
+
gemspec.version = '0.2.1'
|
10
10
|
gemspec.description = "Simple authentication plugin for sinatra."
|
11
11
|
gemspec.summary = "Simple authentication plugin for sinatra."
|
12
12
|
gemspec.homepage = "http://github.com/maxjustus/sinatra-authentication"
|
data/lib/views/edit.haml
CHANGED
@@ -11,26 +11,31 @@
|
|
11
11
|
- else
|
12
12
|
account
|
13
13
|
%form{:action => "/users/#{@user.id}/edit", :method => "post"}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
.field
|
15
|
+
.label
|
16
|
+
%label{:for => "user_email"} Email
|
17
|
+
%input{ :id => "user_email", :name => "user[email]", :size => 30, :type => "text", :value => @user.email }
|
18
|
+
.field
|
19
|
+
.label
|
20
|
+
%label{:for => "user_password"} New password
|
21
|
+
%input{ :id => "user_password", :name => "user[password]", :size => 30, :type => "password" }
|
22
|
+
.field
|
23
|
+
.label
|
24
|
+
%label{:for => "user_password_confirmation"} Confirm
|
25
|
+
%input{ :id => "user_password_confirmation", :name => "user[password_confirmation]", :size => 30, :type => "password" }
|
22
26
|
-# don't render permission field if admin and editing yourself so you don't shoot yourself in the foot
|
23
27
|
- if current_user.admin? && current_user.id != @user.id
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
|
28
|
+
.field
|
29
|
+
.label
|
30
|
+
%label{:for => 'permission_level'} Permission level
|
31
|
+
%select{ :id => "permission_level", :name => "user[permission_level]" }
|
32
|
+
%option{:value => -1, :selected => @user.admin?}
|
33
|
+
Admin
|
34
|
+
%option{:value => 1, :selected => @user.permission_level == 1}
|
35
|
+
Authenticated user
|
36
|
+
.buttons
|
37
|
+
%input{ :value => "Update", :type => "submit" }
|
38
|
+
- if Sinatra.const_defined?('FacebookObject')
|
39
|
+
- unless @user.fb_uid
|
40
|
+
|
|
41
|
+
= render_facebook_connect_link('Link account with Facebook')
|
data/lib/views/login.haml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#sinatra_authentication
|
2
2
|
%h1 Login
|
3
3
|
%form{:action => "/login", :method => "post"}
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
.field
|
5
|
+
.label
|
6
|
+
%label{:for => "user_email'"} Email
|
7
7
|
%input{:id => "user_email", :name => "email", :size => 30, :type => "text"}
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
.field
|
9
|
+
.label
|
10
|
+
%label{:for => "user_password"} Password
|
11
11
|
%input{:id => "user_password", :name => "password", :size => 30, :type => "password"}
|
12
|
-
|
12
|
+
.buttons
|
13
13
|
%input{:value => "login", :type => "submit"}
|
14
|
-
%a{:href => "/signup"}
|
14
|
+
%a{:href => "/signup", :class => 'sinatra_authentication_link'}
|
15
15
|
Signup
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
.facebook_login
|
17
|
+
- if Sinatra.const_defined?('FacebookObject')
|
18
|
+
= render_facebook_connect_link
|
data/lib/views/signup.haml
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
#sinatra_authentication
|
2
2
|
%h1 Signup
|
3
3
|
%form{:action => "/signup", :method => "post"}
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
.field
|
5
|
+
.label
|
6
|
+
%label{:for => "user_email"} Email
|
7
7
|
%input{ :id => "user_email", :name => "user[email]", :size => 30, :type => "text" }
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
.field
|
9
|
+
.label
|
10
|
+
%label{:for => "user_password"} Password
|
11
11
|
%input{ :id => "user_password", :name => "user[password]", :size => 30, :type => "password" }
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
.field
|
13
|
+
.label
|
14
|
+
%label{:for => "user_password_confirmation"} Confirm Password
|
15
15
|
%input{ :id => "user_password_confirmation", :name => "user[password_confirmation]", :size => 30, :type => "password" }
|
16
|
-
|
16
|
+
.buttons
|
17
17
|
%input{ :value => "Create account", :type => "submit" }
|
18
|
+
%a{:href => "/login", :class => 'sinatra_authentication_link'}
|
19
|
+
Login
|
data/readme.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## INSTALLATION:
|
4
4
|
|
5
|
-
in your sinatra app simply require either "dm-core"
|
5
|
+
in your sinatra app simply require either "dm-core", "rufus-tokyo" or "mongo_mapper" and then "sinatra-authentication" and turn on session storage
|
6
6
|
with a super secret key, like so:
|
7
7
|
|
8
8
|
require "dm-core"
|