From 93974e99296641822c734a3c192cc6c550efc696 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 19 Oct 2012 12:09:59 +0200 Subject: moved login navigation to the right --- app/views/layouts/_navigation.html.haml | 12 ++++-------- users/app/views/sessions/_nav.html.haml | 8 ++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 users/app/views/sessions/_nav.html.haml diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 04d2356..b75eed7 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -1,10 +1,6 @@ = link_to "Leap Web", root_path, :class => 'brand' %ul.nav - - if current_user - %li - = link_to t(:logout), logout_path - - else - %li - = link_to t(:login), login_path - %li - = link_to t(:signup), signup_path + // = render '/tickets/nav' + +%ul.nav.pull-right + = render '/sessions/nav' diff --git a/users/app/views/sessions/_nav.html.haml b/users/app/views/sessions/_nav.html.haml new file mode 100644 index 0000000..a5397bd --- /dev/null +++ b/users/app/views/sessions/_nav.html.haml @@ -0,0 +1,8 @@ +- if current_user + %li + = link_to t(:logout), logout_path +- else + %li + = link_to t(:login), login_path + %li + = link_to t(:signup), signup_path -- cgit v1.2.3 From 60619169a56de26825cb55a9a845288eed50de2f Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 19 Oct 2012 12:15:28 +0200 Subject: Revert "Created deploy branch with some springbok specifics" This reverts commit 439e27ef2792a03e5e50f8b9c607fca512cb1452. Conflicts: config/cert --- config/cert | 56 ------------------------------------------ config/deploy.rb | 37 ---------------------------- public/config/eip-service.json | 14 ----------- 3 files changed, 107 deletions(-) delete mode 100644 config/cert delete mode 100644 config/deploy.rb delete mode 100644 public/config/eip-service.json diff --git a/config/cert b/config/cert deleted file mode 100644 index 27db0fd..0000000 --- a/config/cert +++ /dev/null @@ -1,56 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIFfQIBAAKCATEArnxTeU82frha6g4AchpzAA92ry0PD/FZVK5UiMsbwHfAl/XJ -udVH0+51DSC5X4p9esftRQNCaJY/4zESe15Sna7aR+FyUoE+LcPpzMpCYH61TUzj -YLQLzfay6cw1arn QC87f3tvmWI7F0zb9KWE9c -XepnHyr2QJDzMiL This is an invalid eOUK8hc+uTReTXpAtD3S3X -rC3KeJR+jOynTkJ key block for testing Sc6Cz2uJBeARNLvTBAj66q -zfvMIlBOBRCWSQf please replace with a IfExunVQnU+xbRx7W9Gg3i -NV307K4fgLJbY4b valid client key Y69SOuXgz7ECsoXy1bWQsi -TETM5TX/6dADz0z FCc8I167mT25s2HNLnZ8AI -8zqMwDMRf9x7a4GBGmm7n+YSCLy3f8fejw2ZAQIDAQABAoIBMAt3bSQ8Nz3AT20x -XfEusdn/mGSpq7Co3CprStlr+IaVixpe622FPCNOt0x1RMjR2yrzYkvzC9DZperp -mWLj7XF3X8FS3gd0Whhl4bS5yZuC8cd7Gq4bx8mGPIwqQzwOXb1mJXt5RPv+zU6X -J4cSX0GIUBNb1yVsUDouqo1q+saPgBSjhS4xr6sb38XALvzvgVvY/M7YGpSr0Vyv -ErAwxaGpdk+RppAjcxWBXLuMcIgtU+gSoEogdYzJkoJdwOfcyIllyqlaamcv4T84 -gMWRFncCgZkAzUBt1t3GpuyGVPkD2evtQrBWwg09kx1PAyoNwLDOiarmzUr/euvC -4W+BfbvmH3Q1dfyQMc/+Y2/LAhvwwkp1F66KsF1xcz6q3FCDN0BGurhIH3rsS1r8 -m+FZ324xLCYXYBDXCwa3B1YsX9d54JuzXzClr+t0xoz5lZzDLgwEEdK9bttGBL0w -ReIl7KW/TwKDbkPxe+3yCI8CgZkA2aCJUmCtkvaCIX0Udr6g3iyu6lQYbq532/FW -MNh+KJA3NqXOvGZd9T1DfjlxOqsfGD4H92ekUdy/GdX9SAH4A0RW24gUazNY9N1d -tdkq8OAxwswquvXC0U5WXsZVp6z1CFawjUiZbW8CgZkAvP9V5SOkN7LWY0pFJJad -i+oKiXdduqijR/uiXEuyc4v+KQ2lQM/1DEqu0hGKj+enYJtBGPMe+E9+XuZwYMWe -nsmR1/LNPcM0U3LdOvpviOXv7zNUPyri5sMhjuDFnzMHw1REhsnKqk+XtKJ7yLx9 -I8hiBtKUlBUhietNWEQEnQzxxKMRELaAU+1RFJ7vEVb0JUXFCGPrmbsCgZkAyZrW -4Zr+GyGz96AetksM5svDVqVed9qzxqPX7/i16F3HmIJKS8lVXLj3TDBJAQTJNhSN -m+HD6mlClBNzaa2fCTMLtzjAiYhGsRIZbpagCKPRAmcH5bBPSmi+pahBJMBxxdtx -NdhleRCuWBjM0nBAeYZNkIG3qLegqPaJif4zeJ74QWWsDePox8Xr59C6ev23nUUb -MnMW7zECgZkAwOOGuqJHyUlsVuErs5c/rLyY0NAqrGoiBp3o5fGnuINzrZSO3zvY -PcuBeQmnZbkNarfQxFz1ezcf6jmszNStktDj3tFSR8srqpcRKyUPDi1eHD81n8vv -h1jew1zPRQaQvVZ88p0xacYJeRckbKxcIPGweVqpT9ZJAEGg4J6FFcH+fOIra/7R -TgLJs443xbTO2GM/25Anc/Pj4bnL2GWqDTurTxANAtmKenuWHTcz47Pm5WNhZP/l -WWxi9MBzz/80IediLG6qrlU= ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIEAzCCAlWgAwIBAgIEUFDq+zANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDEwRU -RVNUMB4XDTEyMDkxMjIwMDUxNVoXDTEzMDkxMjIwMDUxNVowOjEPMA0GA1UEChMG -YLQLzfay6cw1arn QC87f3tvmWI7F0zb9KWE9c -XepnHyr2QJDzMiL This is an invalid eOUK8hc+uTReTXpAtD3S3X -rC3KeJR+jOynTkJ cert block for testing Sc6Cz2uJBeARNLvTBAj66q -zfvMIlBOBRCWSQf please replace with a IfExunVQnU+xbRx7W9Gg3i -NV307K4fgLJbY4b valid server cert Y69SOuXgz7ECsoXy1bWQsi -TETM5TX/6dADz0z FCc8I167mT25s2HNLnZ8AI -4GFRwh8TG6dVCdT7FtHHtb0aDeLzOozAMxF/3HtrgYEaabuf5hIIvLd/x96PDZkB -WAotdJzoLPa4kF4BE0u9MECPrqrN+8wiUE4FEJZJB+/M2WFm+pfZgp1qXx6AL0IC -AgMBAAGjdjB0MAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDwYD -VR0PAQH/BAUDAwegADAdBgNVHQ4EFgQUU9Uc5ljBzINN4S6oj80rn+mJTLEwHwYD -AMCxt8hxLtQlSgfY4MHxlNOE/hepArRQ1KoqW8TZ3DaDZacYuHK6TkarBuVshrAa -VR0jBBgwFoAU/z1/F2dGNow5Kac+jx7NtyIM0BAwDQYJKoZIhvcNAQELBQADggGX -TkPLvTbMIeZ/DGC6snrnyspVPVun8X1NcdkqOiSWCt5Y1Li4sClXT+XUFaKES4NS -SN8LDKX0J+q2n4nRuotaOdq12qs8ZQkMsSI5ueR0soHY1XuSJCK75PFxLJKq3ydm -FhMVy/bQZgl9QAt7HNK7QoISBmkQFYey0Qq7aotloMhlIyCSN569RcKHdPhZCsCE -c/YgEkmZwOBR7ypXnT0Tcele120v+qhCRSeoZIEwtm27Dp8+My82fpx7xMKYAHn8 -VhdODq6KZ9Tk8MnYenC7SfiJ/cR0N/Yw5R8Yaa1K5qO+dyIwfXTkTr/Kg97N72jE -M6lQJXeXaD8sR9wE2nhxKnTJToebjr9mnlgavSsotnzjnm9fMt5CPGOUtG/qGNfB -GB/GF1HkbZW7VnGWjgNAozftTRCsFoCTwv/ICcW+vYEDVh+hzWjJ/KLl7PruKDPS -rBlWWdV02QtVKpKYKvynML9kyEX6HeM= ------END CERTIFICATE----- diff --git a/config/deploy.rb b/config/deploy.rb deleted file mode 100644 index 9dc058a..0000000 --- a/config/deploy.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "bundler/capistrano" - -set :application, "webapp" - -set :scm, :git -set :repository, "git://leap.se/leap_web" -set :branch, "deploy" - -set :deploy_via, :remote_cache -set :deploy_to, '/home/webapp' -set :use_sudo, false - -set :normalize_asset_timestamps, false - -set :user, "webapp" - -set :git_enable_submodules, 1 # we're using an srp js submodule for now - -role :web, "94.103.43.3" # Your HTTP server, Apache/etc -role :app, "94.103.43.3" # This may be the same as your `Web` server -# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run -# role :db, "your slave db-server here" - -# if you want to clean up old releases on each deploy uncomment this: -# after "deploy:restart", "deploy:cleanup" - -# if you're still using the script/reaper helper you will need -# these http://github.com/rails/irs_process_scripts - -# If you are using Passenger mod_rails uncomment this: -# namespace :deploy do -# task :start do ; end -# task :stop do ; end -# task :restart, :roles => :app, :except => { :no_release => true } do -# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" -# end -# end diff --git a/public/config/eip-service.json b/public/config/eip-service.json deleted file mode 100644 index 29959d7..0000000 --- a/public/config/eip-service.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "serial": 1, - "version": "0.1.0", - "capabilities": { - "transport": ["openvpn"], - "ports": ["80","53", "443", "1194"], - "protocols": ["udp"], - "static_ips": false, - "adblock": false - }, - "gateways": [ - {"country_code": "tr", "name": "turkey", "label": {"en":"Ankara, Turkey"}, "capabilities": {}, "hosts": ["94.103.43.4"]} - ] -} -- cgit v1.2.3 From 4ab1e3e465c3ad4600b55b03a2b0bb099aceff54 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 19 Oct 2012 12:17:00 +0200 Subject: added dummy cert file for tests and illustration --- config/cert | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 config/cert diff --git a/config/cert b/config/cert new file mode 100644 index 0000000..27db0fd --- /dev/null +++ b/config/cert @@ -0,0 +1,56 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIFfQIBAAKCATEArnxTeU82frha6g4AchpzAA92ry0PD/FZVK5UiMsbwHfAl/XJ +udVH0+51DSC5X4p9esftRQNCaJY/4zESe15Sna7aR+FyUoE+LcPpzMpCYH61TUzj +YLQLzfay6cw1arn QC87f3tvmWI7F0zb9KWE9c +XepnHyr2QJDzMiL This is an invalid eOUK8hc+uTReTXpAtD3S3X +rC3KeJR+jOynTkJ key block for testing Sc6Cz2uJBeARNLvTBAj66q +zfvMIlBOBRCWSQf please replace with a IfExunVQnU+xbRx7W9Gg3i +NV307K4fgLJbY4b valid client key Y69SOuXgz7ECsoXy1bWQsi +TETM5TX/6dADz0z FCc8I167mT25s2HNLnZ8AI +8zqMwDMRf9x7a4GBGmm7n+YSCLy3f8fejw2ZAQIDAQABAoIBMAt3bSQ8Nz3AT20x +XfEusdn/mGSpq7Co3CprStlr+IaVixpe622FPCNOt0x1RMjR2yrzYkvzC9DZperp +mWLj7XF3X8FS3gd0Whhl4bS5yZuC8cd7Gq4bx8mGPIwqQzwOXb1mJXt5RPv+zU6X +J4cSX0GIUBNb1yVsUDouqo1q+saPgBSjhS4xr6sb38XALvzvgVvY/M7YGpSr0Vyv +ErAwxaGpdk+RppAjcxWBXLuMcIgtU+gSoEogdYzJkoJdwOfcyIllyqlaamcv4T84 +gMWRFncCgZkAzUBt1t3GpuyGVPkD2evtQrBWwg09kx1PAyoNwLDOiarmzUr/euvC +4W+BfbvmH3Q1dfyQMc/+Y2/LAhvwwkp1F66KsF1xcz6q3FCDN0BGurhIH3rsS1r8 +m+FZ324xLCYXYBDXCwa3B1YsX9d54JuzXzClr+t0xoz5lZzDLgwEEdK9bttGBL0w +ReIl7KW/TwKDbkPxe+3yCI8CgZkA2aCJUmCtkvaCIX0Udr6g3iyu6lQYbq532/FW +MNh+KJA3NqXOvGZd9T1DfjlxOqsfGD4H92ekUdy/GdX9SAH4A0RW24gUazNY9N1d +tdkq8OAxwswquvXC0U5WXsZVp6z1CFawjUiZbW8CgZkAvP9V5SOkN7LWY0pFJJad +i+oKiXdduqijR/uiXEuyc4v+KQ2lQM/1DEqu0hGKj+enYJtBGPMe+E9+XuZwYMWe +nsmR1/LNPcM0U3LdOvpviOXv7zNUPyri5sMhjuDFnzMHw1REhsnKqk+XtKJ7yLx9 +I8hiBtKUlBUhietNWEQEnQzxxKMRELaAU+1RFJ7vEVb0JUXFCGPrmbsCgZkAyZrW +4Zr+GyGz96AetksM5svDVqVed9qzxqPX7/i16F3HmIJKS8lVXLj3TDBJAQTJNhSN +m+HD6mlClBNzaa2fCTMLtzjAiYhGsRIZbpagCKPRAmcH5bBPSmi+pahBJMBxxdtx +NdhleRCuWBjM0nBAeYZNkIG3qLegqPaJif4zeJ74QWWsDePox8Xr59C6ev23nUUb +MnMW7zECgZkAwOOGuqJHyUlsVuErs5c/rLyY0NAqrGoiBp3o5fGnuINzrZSO3zvY +PcuBeQmnZbkNarfQxFz1ezcf6jmszNStktDj3tFSR8srqpcRKyUPDi1eHD81n8vv +h1jew1zPRQaQvVZ88p0xacYJeRckbKxcIPGweVqpT9ZJAEGg4J6FFcH+fOIra/7R +TgLJs443xbTO2GM/25Anc/Pj4bnL2GWqDTurTxANAtmKenuWHTcz47Pm5WNhZP/l +WWxi9MBzz/80IediLG6qrlU= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIIEAzCCAlWgAwIBAgIEUFDq+zANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDEwRU +RVNUMB4XDTEyMDkxMjIwMDUxNVoXDTEzMDkxMjIwMDUxNVowOjEPMA0GA1UEChMG +YLQLzfay6cw1arn QC87f3tvmWI7F0zb9KWE9c +XepnHyr2QJDzMiL This is an invalid eOUK8hc+uTReTXpAtD3S3X +rC3KeJR+jOynTkJ cert block for testing Sc6Cz2uJBeARNLvTBAj66q +zfvMIlBOBRCWSQf please replace with a IfExunVQnU+xbRx7W9Gg3i +NV307K4fgLJbY4b valid server cert Y69SOuXgz7ECsoXy1bWQsi +TETM5TX/6dADz0z FCc8I167mT25s2HNLnZ8AI +4GFRwh8TG6dVCdT7FtHHtb0aDeLzOozAMxF/3HtrgYEaabuf5hIIvLd/x96PDZkB +WAotdJzoLPa4kF4BE0u9MECPrqrN+8wiUE4FEJZJB+/M2WFm+pfZgp1qXx6AL0IC +AgMBAAGjdjB0MAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDwYD +VR0PAQH/BAUDAwegADAdBgNVHQ4EFgQUU9Uc5ljBzINN4S6oj80rn+mJTLEwHwYD +AMCxt8hxLtQlSgfY4MHxlNOE/hepArRQ1KoqW8TZ3DaDZacYuHK6TkarBuVshrAa +VR0jBBgwFoAU/z1/F2dGNow5Kac+jx7NtyIM0BAwDQYJKoZIhvcNAQELBQADggGX +TkPLvTbMIeZ/DGC6snrnyspVPVun8X1NcdkqOiSWCt5Y1Li4sClXT+XUFaKES4NS +SN8LDKX0J+q2n4nRuotaOdq12qs8ZQkMsSI5ueR0soHY1XuSJCK75PFxLJKq3ydm +FhMVy/bQZgl9QAt7HNK7QoISBmkQFYey0Qq7aotloMhlIyCSN569RcKHdPhZCsCE +c/YgEkmZwOBR7ypXnT0Tcele120v+qhCRSeoZIEwtm27Dp8+My82fpx7xMKYAHn8 +VhdODq6KZ9Tk8MnYenC7SfiJ/cR0N/Yw5R8Yaa1K5qO+dyIwfXTkTr/Kg97N72jE +M6lQJXeXaD8sR9wE2nhxKnTJToebjr9mnlgavSsotnzjnm9fMt5CPGOUtG/qGNfB +GB/GF1HkbZW7VnGWjgNAozftTRCsFoCTwv/ICcW+vYEDVh+hzWjJ/KLl7PruKDPS +rBlWWdV02QtVKpKYKvynML9kyEX6HeM= +-----END CERTIFICATE----- -- cgit v1.2.3 From 3ba2e664a26e96a93c8640b57241af6386db361e Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 19 Oct 2012 18:03:37 +0200 Subject: login after signup right away. --- users/app/assets/javascripts/srp | 2 +- users/app/assets/javascripts/users.js.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/users/app/assets/javascripts/srp b/users/app/assets/javascripts/srp index 5a0ceeb..23350b5 160000 --- a/users/app/assets/javascripts/srp +++ b/users/app/assets/javascripts/srp @@ -1 +1 @@ -Subproject commit 5a0ceeb1ca0055719a9b8977a799362163955766 +Subproject commit 23350b54ec2723e1b2e333626567c9fe9d1e2644 diff --git a/users/app/assets/javascripts/users.js.coffee b/users/app/assets/javascripts/users.js.coffee index 1c00663..24302fe 100644 --- a/users/app/assets/javascripts/users.js.coffee +++ b/users/app/assets/javascripts/users.js.coffee @@ -27,7 +27,8 @@ validate_password = (event) -> signup = (event) -> srp = new SRP(jqueryRest()) - srp.register() + srp.register -> + window.location = '/' false login = (event) -> -- cgit v1.2.3 From b5738bdf7abaa671a7363e279592eae73635f572 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 30 Oct 2012 11:38:48 -0700 Subject: new README --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Readme.md | 24 ------------------------ 2 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 README.md delete mode 100644 Readme.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e1ad1a --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +LEAP Web +--------------------- + +"LEAP Web" is the web-based component of the LEAP Platform, providing the following services: + +* REST API for user registration. +* Admin interface to manage users. +* Client certificate distribution and renewal. +* User support help tickets. + +This web application is written in Ruby on Rails 3, using CouchDB as the backend data store. + +Original code specific to this web application is licensed under the GNU Affero General Public License (version 3.0 or higher). See http://www.gnu.org/licenses/agpl-3.0.html for more information. + +Documentation +--------------------------- + +For more information, see these files in the ``doc`` directory: + +* DEPLOY -- for notes on deployment. +* DEVELOP -- for developer notes. +* CUSTOM -- how to customize. + +Installation +--------------------------- + +Typically, this application is installed automatically as part of the LEAP Platform. To install it manually for testing or development, follow these instructions: + +### Install system requirements + + sudo apt-get install git ruby1.8 rubygems1.8 couchdb + sudo gem bundler + +On Debian Wheezy or later, there is a Debian package for bundler, so you can alternately run ``sudo apt-get install bundler``. + +### Download source + + git clone git://leap.se/leap_web + git submodule update --init + +### Install required ruby libraries + + cd leap_web + bundle + +Typically, you run ``bundle`` as a normal user and it will ask you for a sudo password when it is time to install the required gems. If you don't have sudo, run ``bundle`` as root. + +Configuration +---------------------------- + +The webapp can hand out certs for the EIP client. These certs are either picked from a pool in CouchDB or from a file. For now you can either run [Leap CA](http://github.com/leapcode/leap_ca) to fill the pool or you can put your certs file in config/cert. + +We also ship provider information through the webapp. For now please add your eip-service.json to the public/config directory. + +Running +----------------------------- + + cd leap_web + rails server + +Then open http://localhost:3000 in your web browser. + +To peruse the database, visit http://localhost:5984/_utils/ + diff --git a/Readme.md b/Readme.md deleted file mode 100644 index 8b51b4d..0000000 --- a/Readme.md +++ /dev/null @@ -1,24 +0,0 @@ -# Leap Web # - -Web application for LEAP. Currently Leap Web allows Leap providers to manage users, hand out certs for the EIP. - -## Functions ## - -### Supported ### - -* *User Management* - User Registration and Authentication -* *Cert Distribution* - Certs for the Encrypted Internet Proxy - -### Under Development ### - -* *Help Desk* - Managing Help Requests - - -## Documentation ## - -* [INSTALL](https://github.com/leapcode/leap_web/blob/master/INSTALL.md) for installation instructions -* [DEPLOY](https://github.com/leapcode/leap_web/blob/master/DEPLOY.md) for deployment -* [DEVELOP](https://github.com/leapcode/leap_web/blob/master/DEVELOP.md) for developer notes. -* [CUSTOM](https://github.com/leapcode/leap_web/blob/master/CUSTOM.md) to customize. - - -- cgit v1.2.3 From b7cf67590042eca10381a95f8b74070d7430dbdb Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 31 Oct 2012 10:40:03 +0100 Subject: user creation should send ok flag so js can start login --- users/app/models/user.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 8b7c0b3..b57af98 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -44,7 +44,10 @@ class User < CouchRest::Model::Base end def to_json(options={}) - super(options.merge(:only => ['login', 'password_salt'])) + { + :login => login, + :ok => valid? + }.to_json(options) end def initialize_auth(aa) -- cgit v1.2.3 From f738852867423130c49221522eb8825c161b0f5a Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 31 Oct 2012 10:46:38 +0100 Subject: minor: need to cd into leap_web before initializing submodules --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7e1ad1a..3ea47bb 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ On Debian Wheezy or later, there is a Debian package for bundler, so you can alt ### Download source git clone git://leap.se/leap_web + cd leap_web git submodule update --init ### Install required ruby libraries -- cgit v1.2.3 From 4b7333eec8eaf0c01227ade9d77a21f7a879ff0b Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 31 Oct 2012 17:39:06 +0100 Subject: using controller extensions for application controller by hand --- app/controllers/application_controller.rb | 7 +------ users/app/controllers/application_controller.rb | 14 -------------- .../controllers/controller_extension/authentication.rb | 17 +++++++++++++++++ users/config/initializers/add_controller_methods.rb | 3 +++ 4 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 users/app/controllers/application_controller.rb create mode 100644 users/app/controllers/controller_extension/authentication.rb create mode 100644 users/config/initializers/add_controller_methods.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 693bd86..be7aa1f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,10 +1,5 @@ class ApplicationController < ActionController::Base protect_from_forgery - helper_method :current_user - - private - def current_user - @current_user ||= User.find(session[:user_id]) if session[:user_id] - end + ActiveSupport.run_load_hooks(:application_controller, self) end diff --git a/users/app/controllers/application_controller.rb b/users/app/controllers/application_controller.rb deleted file mode 100644 index 64e1a55..0000000 --- a/users/app/controllers/application_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery - - private - - def current_user - @current_user ||= User.find(session[:user_id]) if session[:user_id] - end - helper_method :current_user - - def authorize - redirect_to login_url, alert: "Not authorized" if current_user.nil? - end -end diff --git a/users/app/controllers/controller_extension/authentication.rb b/users/app/controllers/controller_extension/authentication.rb new file mode 100644 index 0000000..507b62f --- /dev/null +++ b/users/app/controllers/controller_extension/authentication.rb @@ -0,0 +1,17 @@ +module ControllerExtension::Authentication + extend ActiveSupport::Concern + + private + + included do + helper_method :current_user + end + + def current_user + @current_user ||= User.find(session[:user_id]) if session[:user_id] + end + + def authorize + redirect_to login_url, :alert => "Not authorized" if current_user.nil? + end +end diff --git a/users/config/initializers/add_controller_methods.rb b/users/config/initializers/add_controller_methods.rb new file mode 100644 index 0000000..2579176 --- /dev/null +++ b/users/config/initializers/add_controller_methods.rb @@ -0,0 +1,3 @@ +ActiveSupport.on_load(:application_controller) do + include ControllerExtension::Authentication +end -- cgit v1.2.3