nyauth 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +24 -6
- data/app/controllers/concerns/nyauth/application_concern.rb +10 -0
- data/app/controllers/concerns/nyauth/client_concern.rb +31 -0
- data/app/controllers/nyauth/confirmation_requests_controller.rb +10 -8
- data/app/controllers/nyauth/confirmations_controller.rb +8 -6
- data/app/controllers/nyauth/new_password_requests_controller.rb +10 -8
- data/app/controllers/nyauth/new_passwords_controller.rb +10 -8
- data/app/controllers/nyauth/passwords_controller.rb +11 -9
- data/app/controllers/nyauth/registrations_controller.rb +10 -8
- data/app/controllers/nyauth/sessions_controller.rb +6 -4
- data/app/helpers/nyauth/application_helper.rb +38 -1
- data/app/mailers/nyauth/request_mailer.rb +15 -0
- data/app/views/nyauth/confirmation_requests/new.html.slim +1 -1
- data/app/views/nyauth/confirmations/edit.html.slim +2 -2
- data/app/views/nyauth/new_password_requests/new.html.slim +1 -1
- data/app/views/nyauth/new_passwords/edit.html.slim +3 -3
- data/app/views/nyauth/passwords/edit.html.slim +3 -3
- data/app/views/nyauth/registrations/new.html.slim +3 -3
- data/app/views/nyauth/request_mailer/request_confirmation.html.slim +2 -0
- data/app/views/nyauth/request_mailer/request_confirmation.text.erb +3 -0
- data/app/views/nyauth/request_mailer/request_new_password.html.slim +2 -0
- data/app/views/nyauth/request_mailer/request_new_password.text.erb +3 -0
- data/app/views/nyauth/sessions/new.html.slim +1 -5
- data/config/routes.rb +1 -1
- data/lib/generators/nyauth/install_generator.rb +11 -0
- data/lib/generators/nyauth/templates/nyauth_install_initializer.rb +7 -0
- data/lib/nyauth/configuration.rb +40 -0
- data/lib/nyauth/engine.rb +2 -0
- data/lib/nyauth/version.rb +1 -1
- data/lib/nyauth.rb +10 -0
- data/spec/dummy/app/controllers/pages_controller.rb +4 -0
- data/spec/dummy/app/controllers/posts_controller.rb +5 -0
- data/spec/dummy/app/models/admin.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -1
- data/spec/dummy/config/routes.rb +7 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150317141956_create_admins.rb +12 -0
- data/spec/dummy/db/schema.rb +11 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1662 -0
- data/spec/dummy/log/test.log +36831 -0
- data/spec/dummy/tmp/capybara/capybara-201503142131285774508896.html +1 -0
- data/spec/dummy/tmp/capybara/capybara-201503142131502672526321.html +1 -0
- data/spec/dummy/tmp/capybara/capybara-201503142132597161072575.html +16 -0
- data/spec/dummy/tmp/capybara/capybara-201503142147454003977122.html +16 -0
- data/spec/dummy/tmp/capybara/capybara-201503150030597512321952.html +1 -0
- data/spec/dummy/tmp/capybara/capybara-201503172332094559831059.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172332489943616503.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172333245353296202.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172335156567049015.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172339176031196898.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172340144947026095.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172341585213923875.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172342188836603353.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172344586782457691.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172346495241516033.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-201503172354248621830336.html +15 -0
- data/spec/dummy/tmp/capybara/capybara-20150623002226753539811.html +15 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/factories/admins.rb +6 -0
- data/spec/featrues/nyauth/registrations_spec.rb +1 -0
- data/spec/featrues/nyauth/sessions_spec.rb +54 -19
- data/spec/featrues/url_helper_on_application_spec.rb +10 -0
- data/spec/helpers/nyauth/application_helper_spec.rb +145 -0
- data/spec/lib/generators/nyauth/install_generator_spec.rb +19 -0
- data/spec/lib/generators/nyauth/tmp/config/initializers/nyauth.rb +7 -0
- data/spec/lib/nyauth/configuration_spec.rb +23 -0
- data/spec/mailers/nyauth/{user_mailer_spec.rb → request_mailer_spec.rb} +3 -3
- metadata +72 -13
- data/app/controllers/nyauth/base_controller.rb +0 -5
- data/app/mailers/nyauth/user_mailer.rb +0 -15
- data/app/views/nyauth/group_requests/new.html.slim +0 -14
- data/app/views/nyauth/groups/show.html.slim +0 -0
- data/app/views/nyauth/user_mailer/request_confirmation.html.slim +0 -2
- data/app/views/nyauth/user_mailer/request_confirmation.text.erb +0 -3
- data/app/views/nyauth/user_mailer/request_new_password.html.slim +0 -2
- data/app/views/nyauth/user_mailer/request_new_password.text.erb +0 -3
- /data/{app/views/nyauth/group_requests/edit.html.slim → spec/dummy/app/views/pages/index.html.slim} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<form class="pure-form" id="new_session_service" action="/session" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign in</legend><input placeholder="Email" type="email" name="session_service[email]" id="session_service_email" /><input placeholder="Password" type="password" name="session_service[password]" id="session_service_password" /><input type="submit" name="commit" value="Sign in" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form><ul><li><a href="/registration/new">sign up</a></li><li><a href="/new_password_requests/new">request new password</a></li></ul>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<form class="pure-form" id="new_session_service" action="/session" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign in</legend><input placeholder="Email" type="email" name="session_service[email]" id="session_service_email" /><input placeholder="Password" type="password" name="session_service[password]" id="session_service_password" /><input type="submit" name="commit" value="Sign in" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form><ul><li><a href="/registration/new">sign up</a></li><li><a href="/new_password_requests/new">request new password</a></li></ul>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
registration success
|
|
13
|
+
|
|
14
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form" id="new_session_service" action="/session" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign in</legend><input placeholder="Email" type="email" name="session_service[email]" id="session_service_email" /><input placeholder="Password" type="password" name="session_service[password]" id="session_service_password" /><input type="submit" name="commit" value="Sign in" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form><ul><li><a href="/registration/new">sign up</a></li><li><a href="/new_password_requests/new">request new password</a></li></ul>
|
|
12
|
+
updated password
|
|
13
|
+
|
|
14
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<form class="pure-form pure-form-stacked" id="edit_user_205" action="/new_passwords/49791165ece3a672817872e6b29d027de63de1331ec260a680c315a6fc6738ef" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="_method" value="patch" /><fieldset><legend></legend><h2>errors</h2><ul class="errors"><li>New password key translation missing: en.activerecord.errors.models.user.attributes.new_password_key.expired</li></ul><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Update" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_user" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="user[email]" id="user_email" /><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_user" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="user[email]" id="user_email" /><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_user" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="user[email]" id="user_email" /><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_user" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="user[email]" id="user_email" /><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_user" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="user[email]" id="user_email" /><input placeholder="Password" type="password" name="user[password]" id="user_password" /><input placeholder="Confirmation" type="password" name="user[password_confirmation]" id="user_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/admin/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/admin/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true" />
|
|
6
|
+
<script src="/assets/application.js" data-turbolinks-track="true"></script>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<form class="pure-form pure-form-stacked" id="new_admin" action="/registration" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><fieldset><legend>Sign up</legend><input placeholder="Email" type="text" name="admin[email]" id="admin_email" /><input placeholder="Password" type="password" name="admin[password]" id="admin_password" /><input placeholder="Confirmation" type="password" name="admin[password_confirmation]" id="admin_password_confirmation" /><input type="submit" name="commit" value="Sign up" data-disable-with="..." class="pure-button pure-button-primary" /></fieldset></form>
|
|
12
|
+
<a href="/posts">URL helper on application</a>
|
|
13
|
+
<a class="pure-menu-link" rel="nofollow" data-method="delete" href="/session">Sign out</a>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
62060
|
|
@@ -1,36 +1,71 @@
|
|
|
1
1
|
require 'rails_helper'
|
|
2
2
|
|
|
3
3
|
RSpec.describe 'Nyauth::Sessions' do
|
|
4
|
-
|
|
4
|
+
context 'user' do
|
|
5
|
+
let(:user) { create(:user) }
|
|
6
|
+
feature 'sign in' do
|
|
7
|
+
background { visit nyauth.new_session_path }
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
scenario 'sign in user' do
|
|
10
|
+
fill_in('session_service_email', with: user.email)
|
|
11
|
+
fill_in('session_service_password', with: user.password)
|
|
12
|
+
click_button('Sign in')
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
fill_in('session_service_password', with: user.password)
|
|
12
|
-
click_button('Sign in')
|
|
14
|
+
expect(page).to have_content('sign in success')
|
|
15
|
+
end
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
scenario "can't sign in user" do
|
|
18
|
+
click_button('Sign in')
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
expect(page).to have_content('invalid')
|
|
21
|
+
end
|
|
19
22
|
|
|
20
|
-
expect(page).to have_content('invalid')
|
|
21
23
|
end
|
|
22
24
|
|
|
25
|
+
feature 'sign out' do
|
|
26
|
+
background do
|
|
27
|
+
sign_in(user)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
scenario 'sign out user' do
|
|
31
|
+
visit root_path
|
|
32
|
+
click_link('Sign out')
|
|
33
|
+
expect(page).to have_content('sign out')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
23
36
|
end
|
|
24
37
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
context 'admin' do
|
|
39
|
+
let(:admin) { create(:admin) }
|
|
40
|
+
feature 'sign in' do
|
|
41
|
+
background { visit new_admin_session_path }
|
|
42
|
+
|
|
43
|
+
scenario 'sign in admin' do
|
|
44
|
+
fill_in('session_service_email', with: admin.email)
|
|
45
|
+
fill_in('session_service_password', with: admin.password)
|
|
46
|
+
click_button('Sign in')
|
|
47
|
+
|
|
48
|
+
expect(page).to have_content('sign in success')
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
scenario "can't sign in admin" do
|
|
52
|
+
click_button('Sign in')
|
|
53
|
+
|
|
54
|
+
expect(page).to have_content('invalid')
|
|
55
|
+
end
|
|
56
|
+
|
|
28
57
|
end
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
59
|
+
feature 'sign out' do
|
|
60
|
+
background do
|
|
61
|
+
sign_in(admin)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
scenario 'sign out admin' do
|
|
65
|
+
visit root_path
|
|
66
|
+
click_link('Sign out')
|
|
67
|
+
expect(page).to have_content('sign out')
|
|
68
|
+
end
|
|
34
69
|
end
|
|
35
70
|
end
|
|
36
71
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'URL helper on Application' do
|
|
4
|
+
feature 'get path on engine' do
|
|
5
|
+
scenario 'can use URL helper on application' do
|
|
6
|
+
visit nyauth.new_session_path
|
|
7
|
+
expect(page).to have_link('URL helper on application')
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Nyauth::ApplicationHelper do
|
|
4
|
+
describe '#session_path_for' do
|
|
5
|
+
subject { helper.session_path_for(client_name) }
|
|
6
|
+
|
|
7
|
+
context 'when client_name is admin' do
|
|
8
|
+
let(:client_name) { :admin }
|
|
9
|
+
it { is_expected.to eq '/admin/session' }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'when client_name is user' do
|
|
13
|
+
let(:client_name) { :user }
|
|
14
|
+
it { is_expected.to eq '/session' }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#new_session_path_for' do
|
|
19
|
+
subject { helper.new_session_path_for(client_name) }
|
|
20
|
+
|
|
21
|
+
context 'when client_name is admin' do
|
|
22
|
+
let(:client_name) { :admin }
|
|
23
|
+
it { is_expected.to eq '/admin/session/new' }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'when client_name is user' do
|
|
27
|
+
let(:client_name) { :user }
|
|
28
|
+
it { is_expected.to eq '/session/new' }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe '#registration_path_for' do
|
|
33
|
+
subject { helper.registration_path_for(client_name) }
|
|
34
|
+
|
|
35
|
+
context 'when client_name is admin' do
|
|
36
|
+
let(:client_name) { :admin }
|
|
37
|
+
it { is_expected.to eq nil }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'when client_name is user' do
|
|
41
|
+
let(:client_name) { :user }
|
|
42
|
+
it { is_expected.to eq '/registration' }
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe '#new_registration_path_for' do
|
|
47
|
+
subject { helper.new_registration_path_for(client_name) }
|
|
48
|
+
|
|
49
|
+
context 'when client_name is admin' do
|
|
50
|
+
let(:client_name) { :admin }
|
|
51
|
+
it { is_expected.to eq nil }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'when client_name is user' do
|
|
55
|
+
let(:client_name) { :user }
|
|
56
|
+
it { is_expected.to eq '/registration/new' }
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe '#password_path_for' do
|
|
61
|
+
subject { helper.password_path_for(client_name) }
|
|
62
|
+
|
|
63
|
+
context 'when client_name is admin' do
|
|
64
|
+
let(:client_name) { :admin }
|
|
65
|
+
it { is_expected.to eq nil }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'when client_name is user' do
|
|
69
|
+
let(:client_name) { :user }
|
|
70
|
+
it { is_expected.to eq "/password" }
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe '#new_confirmation_request_path_for' do
|
|
75
|
+
subject { helper.new_confirmation_request_path_for(client_name) }
|
|
76
|
+
|
|
77
|
+
context 'when client_name is admin' do
|
|
78
|
+
let(:client_name) { :admin }
|
|
79
|
+
it { is_expected.to eq nil }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context 'when client_name is user' do
|
|
83
|
+
let(:client_name) { :user }
|
|
84
|
+
it { is_expected.to eq "/confirmation_requests/new" }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
describe '#confirmation_path_for(:confirmation_key)' do
|
|
89
|
+
subject { helper.confirmation_path_for(client_name, confirmation_key) }
|
|
90
|
+
let(:confirmation_key) { 'hogehoge' }
|
|
91
|
+
|
|
92
|
+
context 'when client_name is admin' do
|
|
93
|
+
let(:client_name) { :admin }
|
|
94
|
+
it { is_expected.to eq nil }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
context 'when client_name is user' do
|
|
98
|
+
let(:client_name) { :user }
|
|
99
|
+
it { is_expected.to eq "/confirmations/#{confirmation_key}" }
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
describe '#new_password_requests_path_for' do
|
|
104
|
+
subject { helper.new_password_requests_path_for(client_name) }
|
|
105
|
+
|
|
106
|
+
context 'when client_name is admin' do
|
|
107
|
+
let(:client_name) { :admin }
|
|
108
|
+
it { is_expected.to eq nil }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
context 'when client_name is user' do
|
|
112
|
+
let(:client_name) { :user }
|
|
113
|
+
it { is_expected.to eq "/new_password_requests" }
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
describe '#new_new_password_request_path_for' do
|
|
118
|
+
subject { helper.new_new_password_request_path_for(client_name) }
|
|
119
|
+
|
|
120
|
+
context 'when client_name is admin' do
|
|
121
|
+
let(:client_name) { :admin }
|
|
122
|
+
it { is_expected.to eq nil }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
context 'when client_name is user' do
|
|
126
|
+
let(:client_name) { :user }
|
|
127
|
+
it { is_expected.to eq "/new_password_requests/new" }
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
describe '#new_password_path_for(:new_password_key)' do
|
|
132
|
+
subject { helper.new_password_path_for(client_name, new_password_key) }
|
|
133
|
+
let(:new_password_key) { 'hogehoge' }
|
|
134
|
+
|
|
135
|
+
context 'when client_name is admin' do
|
|
136
|
+
let(:client_name) { :admin }
|
|
137
|
+
it { is_expected.to eq nil }
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
context 'when client_name is user' do
|
|
141
|
+
let(:client_name) { :user }
|
|
142
|
+
it { is_expected.to eq "/new_passwords/#{new_password_key}" }
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
require 'generators/nyauth/install_generator'
|
|
3
|
+
|
|
4
|
+
describe Nyauth::InstallGenerator, type: :generator do
|
|
5
|
+
destination ::File.expand_path('../tmp/', __FILE__)
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
prepare_destination
|
|
9
|
+
run_generator
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'rails g nyauth:install' do
|
|
13
|
+
it 'creates a test initializer' do
|
|
14
|
+
assert_file 'config/initializers/nyauth.rb', /config.redirect_path_after_sign_in/
|
|
15
|
+
assert_file 'config/initializers/nyauth.rb', /config.redirect_path_after_sign_out/
|
|
16
|
+
assert_file 'config/initializers/nyauth.rb', /config.redirect_path do |urls|/
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Nyauth::Configuration do
|
|
4
|
+
describe '#configure' do
|
|
5
|
+
let(:redirect_path_after_sign_in) { '/posts' }
|
|
6
|
+
before do
|
|
7
|
+
# applicationの
|
|
8
|
+
# config/initializers/nyauth.rb
|
|
9
|
+
Nyauth.configure do |config|
|
|
10
|
+
config.redirect_path do |urls|
|
|
11
|
+
config.redirect_path_after_sign_in = redirect_path_after_sign_in
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
# nyauthの
|
|
15
|
+
# config/rotues.rbから呼ばれる
|
|
16
|
+
Nyauth.configuration.setup_redirect_path
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
subject { Nyauth.configuration.redirect_path_after_sign_in }
|
|
20
|
+
|
|
21
|
+
it { is_expected.to eq redirect_path_after_sign_in }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
require "rails_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe Nyauth::
|
|
3
|
+
RSpec.describe Nyauth::RequestMailer do
|
|
4
4
|
describe '#request_confirmation' do
|
|
5
5
|
let(:user) { create(:user, :requested_confirmation) }
|
|
6
|
-
subject(:mail) { Nyauth::
|
|
6
|
+
subject(:mail) { Nyauth::RequestMailer.request_confirmation(user) }
|
|
7
7
|
it { expect(mail).to have_body_text 'Plese confirm your email' }
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#request_new_password' do
|
|
11
11
|
let(:user) { create(:user, :requested_new_password) }
|
|
12
|
-
subject(:mail) { Nyauth::
|
|
12
|
+
subject(:mail) { Nyauth::RequestMailer.request_new_password(user) }
|
|
13
13
|
it { expect(mail).to have_body_text 'Plese set your new password' }
|
|
14
14
|
end
|
|
15
15
|
end
|