-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpbb_auth_extension.rb
50 lines (36 loc) · 1.12 KB
/
phpbb_auth_extension.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Uncomment this if you reference any of your controllers in activate
require_dependency 'application'
class PhpbbAuthExtension < Spree::Extension
version "1.0"
description "Use an existing phpBB installation as your login/authenticaton mechanism"
url "http://matthewfawcett.co.uk"
# Please use php_bb_auth/config/routes.rb instead for extension routes.
# def self.require_gems(config)
# config.gem "gemname-goes-here", :version => '1.2.3'
# end
def activate
end
ApplicationController.class_eval do
require "lib/phpbb_auth"
include PhpbbAuthLib
before_filter :run_phpbb_auth
end
UsersController.class_eval do
include PhpbbAuthHelper
def new
redirect_to(prepare_phpbb_url(PHPBB_AUTH_FORUM_REGISTER_URL))
end
def edit
redirect_to(prepare_phpbb_url(PHPBB_AUTH_FORUM_MYACCOUNT_URL))
end
end
AccountController.class_eval do
include PhpbbAuthHelper
def login
redirect_to(prepare_phpbb_url(PHPBB_AUTH_FORUM_LOGIN_URL))
end
def logout
redirect_to(prepare_phpbb_url(PHPBB_AUTH_FORUM_LOGOUT_URL))
end
end
end