diff --git a/addons/auth_oauth/__openerp__.py b/addons/auth_oauth/__openerp__.py index c81f52663c4..4b162695e86 100644 --- a/addons/auth_oauth/__openerp__.py +++ b/addons/auth_oauth/__openerp__.py @@ -36,14 +36,9 @@ Allow users to login through OAuth2 Provider. 'auth_oauth_data.xml', 'auth_oauth_data.yml', 'auth_oauth_view.xml', - 'security/ir.model.access.csv' + 'security/ir.model.access.csv', + 'views/auth_oauth_login.xml', ], - 'js': ['static/src/js/auth_oauth.js'], - 'css': [ - 'static/lib/zocial/css/zocial.css', - 'static/src/css/auth_oauth.css', - ], - 'qweb': ['static/src/xml/auth_oauth.xml'], 'installable': True, 'auto_install': False, } diff --git a/addons/auth_oauth/auth_oauth_data.xml b/addons/auth_oauth/auth_oauth_data.xml index 983549f9378..6abdab41b7c 100644 --- a/addons/auth_oauth/auth_oauth_data.xml +++ b/addons/auth_oauth/auth_oauth_data.xml @@ -17,7 +17,7 @@ https://graph.facebook.com/me/permissions - zocial facebook + fa fa-facebook-square Log in with facebook @@ -26,7 +26,7 @@ https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/oauth2/v1/tokeninfo https://www.googleapis.com/oauth2/v1/userinfo - zocial google + fa fa-google-plus-square Log in with google diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index af8b36d2556..dfcb21e91b2 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -1,4 +1,3 @@ -import functools import logging import simplejson @@ -8,51 +7,72 @@ from werkzeug.exceptions import BadRequest import openerp from openerp import SUPERUSER_ID from openerp import http -from openerp.http import request +from openerp.http import request, LazyResponse from openerp.addons.web.controllers.main import db_monodb, set_cookie_and_redirect, login_and_redirect from openerp.modules.registry import RegistryManager +from openerp.tools.translate import _ _logger = logging.getLogger(__name__) -#---------------------------------------------------------- -# helpers -#---------------------------------------------------------- -def fragment_to_query_string(func): - @functools.wraps(func) - def wrapper(self, *a, **kw): - if not kw: - return """""" - return func(self, *a, **kw) - return wrapper - - #---------------------------------------------------------- # Controller #---------------------------------------------------------- +class OAuthLogin(openerp.addons.web.controllers.main.Home): + def list_providers(self): + try: + provider_obj = request.registry.get('auth.oauth.provider') + providers = provider_obj.search_read(request.cr, SUPERUSER_ID, [('enabled', '=', True)]) + except Exception: + providers = [] + for provider in providers: + return_url = request.httprequest.url_root + 'auth_oauth/signin' + state = dict( + d=request.session.db, + p=provider['id'] + ) + params = dict( + debug=request.debug, + response_type='token', + client_id=provider['client_id'], + redirect_uri=return_url, + scope=provider['scope'], + state=simplejson.dumps(state), + ) + provider['auth_link'] = provider['auth_endpoint'] + '?' + werkzeug.url_encode(params) + + return providers + + @http.route() + def web_login(self, *args, **kw): + # TODO: ensure_db() + request.disable_db = False + + response = super(OAuthLogin, self).web_login(*args, **kw) + if isinstance(response, LazyResponse): + error = request.params.get('oauth_error') + if error == '1': + error = _("Sign up is not allowed on this database.") + elif error == '2': + error = _("Access Denied") + elif error == '3': + error = _("You do not have access to this database or your invitation has expired. Please ask for an invitation and be sure to follow the link in your invitation email.") + else: + error = None + response.params['values'].update( + providers=self.list_providers(), + error=error, + ) + + # TODO: code in old js controller that should be converted in auth_oauth_signup + # if (this.oauth_providers.length === 1 && params.type === 'signup') { + # this.do_oauth_sign_in(this.oauth_providers[0]); + # } + + return response + class OAuthController(http.Controller): - @http.route('/auth_oauth/list_providers', type='json', auth='none') - def list_providers(self, dbname): - try: - registry = RegistryManager.get(dbname) - with registry.cursor() as cr: - providers = registry.get('auth.oauth.provider') - l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled', '=', True)])) - except Exception: - l = [] - return l - @http.route('/auth_oauth/signin', type='http', auth='none') - @fragment_to_query_string def signin(self, **kw): state = simplejson.loads(kw['state']) dbname = state['d'] @@ -66,27 +86,27 @@ class OAuthController(http.Controller): cr.commit() action = state.get('a') menu = state.get('m') - url = '/' + url = '/web' if action: - url = '/#action=%s' % action + url = '/web#action=%s' % action elif menu: - url = '/#menu_id=%s' % menu + url = '/web#menu_id=%s' % menu return login_and_redirect(*credentials, redirect_url=url) except AttributeError: # auth_signup is not installed _logger.error("auth_signup not installed on database %s: oauth sign up cancelled." % (dbname,)) - url = "/#action=login&oauth_error=1" + url = "/web/login?oauth_error=1" except openerp.exceptions.AccessDenied: # oauth credentials not valid, user could be on a temporary session _logger.info('OAuth2: access denied, redirect to main page in case a valid session exists, without setting cookies') - url = "/#action=login&oauth_error=3" + url = "/web/login?oauth_error=3" redirect = werkzeug.utils.redirect(url, 303) redirect.autocorrect_location_header = False return redirect except Exception, e: # signup error _logger.exception("OAuth2: %s" % str(e)) - url = "/#action=login&oauth_error=2" + url = "/web/login?oauth_error=2" return set_cookie_and_redirect(url) @@ -105,7 +125,7 @@ class OAuthController(http.Controller): try: model, provider_id = IMD.get_object_reference(cr, SUPERUSER_ID, 'auth_oauth', 'provider_openerp') except ValueError: - return set_cookie_and_redirect('/?db=%s' % dbname) + return set_cookie_and_redirect('/web?db=%s' % dbname) assert model == 'auth.oauth.provider' state = { diff --git a/addons/auth_oauth/static/lib/zocial/README.md b/addons/auth_oauth/static/lib/zocial/README.md deleted file mode 100644 index 213132677af..00000000000 --- a/addons/auth_oauth/static/lib/zocial/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Zocial CSS social buttons - -I basically rewrote this entire set so they are full vector buttons, meaning: - -- @font-face icons -- custom font file for all social icons -- icon font use private unicode spaces for accessibility -- em sizing based on button font-size -- support for about 83 different services -- buttons and icons supported -- no raster images (sweet) -- works splendidly on any browser supporting @font-face -- CSS3 degrades gracefully in IE8 and below etc. -- also includes generic icon-less primary and secondary buttons - -## How to use these buttons - - - -or - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.ttf b/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.ttf deleted file mode 100644 index 94809d3a57f..00000000000 Binary files a/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.ttf and /dev/null differ diff --git a/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.woff b/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.woff deleted file mode 100644 index 1d6c4abc9d9..00000000000 Binary files a/addons/auth_oauth/static/lib/zocial/css/zocial-regular-webfont.woff and /dev/null differ diff --git a/addons/auth_oauth/static/lib/zocial/css/zocial.css b/addons/auth_oauth/static/lib/zocial/css/zocial.css deleted file mode 100644 index 89fc7450631..00000000000 --- a/addons/auth_oauth/static/lib/zocial/css/zocial.css +++ /dev/null @@ -1,420 +0,0 @@ -@charset "UTF-8"; - -/*! -Code written by Sam Collins (@smcllns) of www.eventasaur.us -You are free to use this work commercially -You are free to extend this work without permissions from the author (just do so tastefully eh?) -Enjoy -*/ - -/* Reference icons from font-files */ - -@font-face { - font-family: 'zocial'; - font-style: normal; - font-weight: normal; - src: url('zocial-regular-webfont.eot'); - src: url('zocial-regular-webfont.eot?#iefix') format('embedded-opentype'), - url('zocial-regular-webfont.woff') format('woff'), - url('zocial-regular-webfont.ttf') format('truetype'), - url('zocial-regular-webfont.svg#ZocialRegular') format('svg'); - unicode-range: U+0-U+10FFFF; -} - -/* Button structure */ - -.zocial, -a.zocial { - border: 1px solid #777; - border-color: rgba(0,0,0,0.2); - border-bottom-color: #333; - border-bottom-color: rgba(0,0,0,0.4); - color: #fff; - -moz-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); - -webkit-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); - box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); - cursor: pointer; - display: inline-block; - font: bold 100%/2.1 "Lucida Grande", Tahoma, sans-serif; - padding: 0 .95em 0 0; - text-align: center; - text-decoration: none; - text-shadow: 0 1px 0 rgba(0,0,0,0.5); - white-space: nowrap; - - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; - - position: relative; - - -moz-border-radius: .3em; - -webkit-border-radius: .3em; - border-radius: .3em; -} - -.zocial:before { - content: ""; - border-right: 0.075em solid rgba(0,0,0,0.1); - float: left; - font: 120%/1.65 zocial; - font-style: normal; - font-weight: normal; - margin: 0 0.5em 0 0; - padding: 0 0.5em; - text-align: center; - text-decoration: none; - text-transform: none; - - -moz-box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); - -webkit-box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); - box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); - - -webkit-font-smoothing: antialiased; -} - -.zocial:active { - outline: none; /* outline is visible on :focus */ -} - -/* Buttons can be displayed as standalone icons by adding a class of "icon" */ - -.zocial.icon { - overflow: hidden; - max-width: 2.4em; - padding-left: 0; - padding-right: 0; - max-height: 2.15em; - white-space: nowrap; -} -.zocial.icon:before { - padding: 0; - width: 2em; - height: 2em; - - box-shadow: none; - border: none; -} - -/* Gradients */ - -.zocial { - background-image: -moz-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); - background-image: -ms-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); - background-image: -o-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); - background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.1)), color-stop(49%, rgba(255,255,255,.05)), color-stop(51%, rgba(0,0,0,.05)), to(rgba(0,0,0,.1))); - background-image: -webkit-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); - background-image: linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); -} - -.zocial:hover, .zocial:focus { - background-image: -moz-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); - background-image: -ms-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); - background-image: -o-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); - background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.15)), color-stop(49%, rgba(255,255,255,.15)), color-stop(51%, rgba(0,0,0,.1)), to(rgba(0,0,0,.15))); - background-image: -webkit-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); - background-image: linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); -} - -.zocial:active { - background-image: -moz-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); - background-image: -ms-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); - background-image: -o-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); - background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.1)), color-stop(30%, rgba(255,255,255,0)), color-stop(50%, transparent), to(rgba(0,0,0,.1))); - background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); - background-image: linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); -} - -/* Adjustments for light background buttons */ - -.zocial.bitcoin, -.zocial.cloudapp, -.zocial.dropbox, -.zocial.email, -.zocial.eventful, -.zocial.github, -.zocial.gmail, -.zocial.instapaper, -.zocial.itunes, -.zocial.ninetyninedesigns, -.zocial.openid, -.zocial.plancast, -.zocial.posterous, -.zocial.reddit, -.zocial.secondary, -.zocial.viadeo, -.zocial.weibo, -.zocial.wikipedia { - border: 1px solid #aaa; - border-color: rgba(0,0,0,0.3); - border-bottom-color: #777; - border-bottom-color: rgba(0,0,0,0.5); - -moz-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); - -webkit-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); - box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); - text-shadow: 0 1px 0 rgba(255,255,255,0.8); -} - -/* :hover adjustments for light background buttons */ - -.zocial.bitcoin:focus, -.zocial.bitcoin:hover, -.zocial.dropbox:focus, -.zocial.dropbox:hover, -.zocial.email:focus, -.zocial.email:hover, -.zocial.eventful:focus, -.zocial.eventful:hover, -.zocial.github:focus, -.zocial.github:hover, -.zocial.gmail:focus, -.zocial.gmail:hover, -.zocial.instapaper:focus, -.zocial.instapaper:hover, -.zocial.itunes:focus, -.zocial.itunes:hover, -.zocial.ninetyninedesigns:focus, -.zocial.ninetyninedesigns:hover, -.zocial.openid:focus, -.zocial.openid:hover, -.zocial.plancast:focus, -.zocial.plancast:hover, -.zocial.posterous:focus, -.zocial.posterous:hover, -.zocial.reddit:focus, -.zocial.reddit:hover, -.zocial.secondary:focus, -.zocial.secondary:hover, -.zocial.twitter:focus, -.zocial.viadeo:focus, -.zocial.viadeo:hover, -.zocial.weibo:focus, -.zocial.weibo:hover, -.zocial.wikipedia:focus, -.zocial.wikipedia:hover { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.5)), color-stop(49%, rgba(255,255,255,0.2)), color-stop(51%, rgba(0,0,0,0.05)), to(rgba(0,0,0,0.15))); - background-image: -moz-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); - background-image: -webkit-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); - background-image: -o-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); - background-image: -ms-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); - background-image: linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); -} - -/* :active adjustments for light background buttons */ - -.zocial.bitcoin:active, -.zocial.dropbox:active, -.zocial.email:active, -.zocial.eventful:active, -.zocial.github:active, -.zocial.gmail:active, -.zocial.instapaper:active, -.zocial.itunes:active, -.zocial.ninetyninedesigns:active, -.zocial.openid:active, -.zocial.plancast:active, -.zocial.posterous:active, -.zocial.reddit:active, -.zocial.secondary:active, -.zocial.viadeo:active, -.zocial.weibo:active, -.zocial.wikipedia:active { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0)), color-stop(30%, rgba(255,255,255,0)), color-stop(50%, rgba(0,0,0,0)), to(rgba(0,0,0,0.1))); - background-image: -moz-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); - background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); - background-image: -o-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); - background-image: -ms-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); - background-image: linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); -} - -/* Button icon and color */ -/* Icon characters are stored in unicode private area */ -.zocial.amazon:before {content: "\E040";} -.zocial.android:before {content: "\E005";} -.zocial.angellist:before {content: "\E06C";} -.zocial.aol:before {content: "\E001";} -.zocial.appstore:before {content: "\E020";} -.zocial.bitcoin:before {content: "\E011"; color: #f7931a;} -.zocial.blogger:before {content: "\E021";} -.zocial.call:before {content: "\E016";} -.zocial.cal:before {content: "\E00D";} -.zocial.cart:before {content: "\E06A";} -.zocial.chrome:before {content: "\E03A";} -.zocial.cloudapp:before {content: "\E042";} -.zocial.creativecommons:before {content: "\E022";} -.zocial.delicious:before {content: "\E002";} -.zocial.digg:before {content: "\E01A";} -.zocial.disqus:before {content: "\E030";} -.zocial.dribbble:before {content: "\E023";} -.zocial.dropbox:before {content: "\E043"; color: #1f75cc;} -.zocial.email:before {content: "\E03C"; color: #312c2a;} -.zocial.eventasaurus:before {content: "\E055"; color: #9de428;} -.zocial.eventbrite:before {content: "\E05B";} -.zocial.eventful:before {content: "\E006"; color: #0066CC;} -.zocial.evernote:before {content: "\E024";} -.zocial.facebook:before {content: "\E045";} -.zocial.fivehundredpx:before {content: "\E00F"; color: #29b6ff;} -.zocial.flattr:before {content: "\E004";} -.zocial.flickr:before {content: "\E025";} -.zocial.forrst:before {content: "\E019"; color: #50894f;} -.zocial.foursquare:before {content: "\E013";} -.zocial.github:before {content: "\E046";} -.zocial.gmail:before {content: "\E04C"; color: #f00;} -.zocial.google:before {content: "\E026";} -.zocial.googleplay:before {content: "\E05E";} -.zocial.googleplus:before {content: "\E00A";} -.zocial.gowalla:before {content: "\E01F";} -.zocial.grooveshark:before {content: "\E017";} -.zocial.guest:before {content: "\E01E";} -.zocial.html5:before {content: "\E014";} -.zocial.ie:before {content: "\E015";} -.zocial.instagram:before {content: "\E06D";} -.zocial.instapaper:before {content: "\E028";} -.zocial.intensedebate:before {content: "\E05A";} -.zocial.itunes:before {content: "\E048"; color: #1a6dd2;} -.zocial.klout:before {content: "\E02A"; } -.zocial.lanyrd:before {content: "\E00C";} -.zocial.lastfm:before {content: "\E04B";} -.zocial.linkedin:before {content: "\E02B";} -.zocial.macstore:before {content: "\E03D";} -.zocial.meetup:before {content: "\E02C";} -.zocial.myspace:before {content: "\E03E";} -.zocial.ninetyninedesigns:before {content: "\E018"; color: #f50;} -.zocial.openid:before {content: "\E04E"; color: #ff921d;} -.zocial.opentable:before {content: "\E05F";} -.zocial.paypal:before {content: "\E003";} -.zocial.pinboard:before {content: "\E04D";} -.zocial.pinterest:before {content: "\E010";} -.zocial.plancast:before {content: "\E02F";} -.zocial.plurk:before {content: "\E049";} -.zocial.podcast:before {content: "\E03F";} -.zocial.posterous:before {content: "\E05D";} -.zocial.print:before {content: "\E06B";} -.zocial.quora:before {content: "\E050";} -.zocial.reddit:before {content: "\E01D"; color: red;} -.zocial.rss:before {content: "\E031";} -.zocial.scribd:before {content: "\E05C"; color: #00d5ea;} -.zocial.skype:before {content: "\E032";} -.zocial.smashing:before {content: "\E009";} -.zocial.songkick:before {content: "\E04A";} -.zocial.soundcloud:before {content: "\E052";} -.zocial.spotify:before {content: "\E01C";} -.zocial.stumbleupon:before {content: "\E00E";} -.zocial.tumblr:before {content: "\E053";} -.zocial.twitter:before {content: "\E033";} -.zocial.viadeo:before {content: "\E027"; color: #f59b20;} -.zocial.vimeo:before {content: "\E035";} -.zocial.weibo:before {content: "\E029"; color: #e6162d;} -.zocial.wikipedia:before {content: "\E00B";} -.zocial.windows:before {content: "\E036";} -.zocial.xing:before {content: "\E037"} -.zocial.wordpress:before {content: "\E056";} -.zocial.yahoo:before {content: "\E038";} -.zocial.yelp:before {content: "\E058";} -.zocial.youtube:before {content: "\E034";} - -/* Button background and text color */ - -.zocial.amazon {background-color: #ffad1d; color: #030037; text-shadow: 0 1px 0 rgba(255,255,255,0.5);} -.zocial.android {background-color: #a4c639;} -.zocial.angellist {background-color: #000;} -.zocial.aol {background-color: #f00;} -.zocial.appstore {background-color: #000;} -.zocial.bitcoin {background-color: #efefef; color: #4d4d4d;} -.zocial.blogger {background-color: #ee5a22;} -.zocial.call {background-color: #008000;} -.zocial.cal {background-color: #d63538;} -.zocial.cart {background-color: #333;} -.zocial.chrome {background-color: #006cd4;} -.zocial.cloudapp {background-color: #fff; color: #312c2a;} -.zocial.creativecommons {background-color: #000;} -.zocial.delicious {background-color: #3271cb;} -.zocial.digg {background-color: #164673;} -.zocial.disqus {background-color: #5d8aad;} -.zocial.dribbble {background-color: #ea4c89;} -.zocial.dropbox {background-color: #fff; color: #312c2a;} -.zocial.email {background-color: #f0f0eb; color: #312c2a;} -.zocial.eventasaurus {background-color: #192931; color: #fff;} -.zocial.eventbrite {background-color: #ff5616;} -.zocial.eventful {background-color: #fff; color: #47ab15;} -.zocial.evernote {background-color: #6bb130; color: #fff;} -.zocial.facebook {background-color: #4863ae;} -.zocial.fivehundredpx {background-color: #333;} -.zocial.flattr {background-color: #8aba42;} -.zocial.flickr {background-color: #ff0084;} -.zocial.forrst {background-color: #1e360d;} -.zocial.foursquare {background-color: #44a8e0;} -.zocial.github {background-color: #fbfbfb; color: #050505;} -.zocial.gmail {background-color: #efefef; color: #222;} -.zocial.google {background-color: #4e6cf7;} -.zocial.googleplay {background-color: #000;} -.zocial.googleplus {background-color: #dd4b39;} -.zocial.gowalla {background-color: #ff720a;} -.zocial.grooveshark {background-color: #111; color:#eee;} -.zocial.guest {background-color: #1b4d6d;} -.zocial.html5 {background-color: #ff3617;} -.zocial.ie {background-color: #00a1d9;} -.zocial.instapaper {background-color: #eee; color: #222;} -.zocial.instagram {background-color: #3f729b;} -.zocial.intensedebate {background-color: #0099e1;} -.zocial.klout {background-color: #e34a25;} -.zocial.itunes {background-color: #efefeb; color: #312c2a;} -.zocial.lanyrd {background-color: #2e6ac2;} -.zocial.lastfm {background-color: #dc1a23;} -.zocial.linkedin {background-color: #0083a8;} -.zocial.macstore {background-color: #007dcb} -.zocial.meetup {background-color: #ff0026;} -.zocial.myspace {background-color: #000;} -.zocial.ninetyninedesigns {background-color: #fff; color: #072243;} -.zocial.openid {background-color: #f5f5f5; color: #333;} -.zocial.opentable {background-color: #990000;} -.zocial.paypal {background-color: #fff; color: #32689a; text-shadow: 0 1px 0 rgba(255,255,255,0.5);} -.zocial.pinboard {background-color: blue;} -.zocial.pinterest {background-color: #c91618;} -.zocial.plancast {background-color: #e7ebed; color: #333;} -.zocial.plurk {background-color: #cf682f;} -.zocial.podcast {background-color: #9365ce;} -.zocial.posterous {background-color: #ffd959; color: #bc7134;} -.zocial.print {background-color: #f0f0eb; color: #222; text-shadow: 0 1px 0 rgba(255,255,255,0.8);} -.zocial.quora {background-color: #a82400;} -.zocial.reddit {background-color: #fff; color: #222;} -.zocial.rss {background-color: #ff7f25;} -.zocial.scribd {background-color: #231c1a;} -.zocial.skype {background-color: #00a2ed;} -.zocial.smashing {background-color: #ff4f27;} -.zocial.songkick {background-color: #ff0050;} -.zocial.soundcloud {background-color: #ff4500;} -.zocial.spotify {background-color: #60af00;} -.zocial.stumbleupon {background-color: #eb4924;} -.zocial.tumblr {background-color: #374a61;} -.zocial.twitter {background-color: #46c0fb;} -.zocial.viadeo {background-color: #fff; color: #000;} -.zocial.vimeo {background-color: #00a2cd;} -.zocial.weibo {background-color: #faf6f1; color: #000;} -.zocial.wikipedia {background-color: #fff; color: #000;} -.zocial.windows {background-color: #0052a4; color: #fff;} -.zocial.wordpress {background-color: #464646;} -.zocial.xing {background-color: #0A5D5E;} -.zocial.yahoo {background-color: #a200c2;} -.zocial.yelp {background-color: #e60010;} -.zocial.youtube {background-color: #f00;} - -/* -The Miscellaneous Buttons -These button have no icons and can be general purpose buttons while ensuring consistent button style -Credit to @guillermovs for suggesting -*/ - -.zocial.primary, .zocial.secondary {margin: 0.1em 0; padding: 0 1em;} -.zocial.primary:before, .zocial.secondary:before {display: none;} -.zocial.primary {background-color: #333;} -.zocial.secondary {background-color: #f0f0eb; color: #222; text-shadow: 0 1px 0 rgba(255,255,255,0.8);} - -/* Any browser-specific adjustments */ - -button:-moz-focus-inner { - border: 0; - padding: 0; -} - - diff --git a/addons/auth_oauth/static/lib/zocial/sample.html b/addons/auth_oauth/static/lib/zocial/sample.html deleted file mode 100644 index 98dec554ff1..00000000000 --- a/addons/auth_oauth/static/lib/zocial/sample.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - Zocial CSS3 Buttons - - - - - - - - - - - - Sign in with Facebook - Sign in with Google+ - Sign in with Twitter - Sign in with LinkedIn - -

The Cool Kids

- Sync with Dropbox - Clip to Evernote - Follow me on Forrst - Sign in with Dribbble - Sign in to CloudApp - Fork me on Github - Play on Spotify - Read It Later - Follow me on Soundcloud - Follow me on Tumblr - Read on Smashing Magazine - Available on iTunes - Available on the App Store - Available on the Mac App Store - Available on Android Market - Follow me on Pinterest - Follow me on Quora - Attend on Lanyrd - -

The Not-So-Cool But Have-To-Be-Invited Kids

- Pay with Paypal - Sign in with Amazon - Call me on Skype - Sign in with Last.fm - Write a review on Yelp - Check in with foursquare - Influence with Klout - -

The Older (but Solid) Kids

- View on Wikipedia - Sign in with Disqus - Sign in with IntenseDebate - Sign in with Google - Sign in with Gmail - Upload to Vimeo - Read more on Scribd - Subscribe on YouTube - Sign in with WordPress - Sign in with Songkick - Sign in with Posterous - Sign in with Eventbrite - Tip with Flattr - Follow me on Plancast - - -

The Kids That Kinda Smell but Some People Don't Mind

- Submit resume for CEO - Download Internet Explorer 5 - Report bugs with Meetup.com - Learn how-to-use OpenID - Register now for HTML6 - Chat with your parents - -

The Kids That Nobody Normally Notices

- Sign in as guest - View Creative Commons Licence - Subscribe to RSS - Add to Chrome - -

The He's-My-Son-So-Of-Course-He's-Here Kid

- Sign up for Eventasaurus - -

Kids By Request

- Join me on Weibo - Sign in with Plurk - Play on Grooveshark - Post on Blogger - Sign in with Viadeo - Subscribe to this Podcast - View Portfolio on 500px - Bitcoin accepted here - View Portfolio on 99Designs - Bookmark with Pinboard - Stumble! - Find me on Myspace - Sign in with Windows Live - Find Events with Eventful - Sign in with Xing - Upload to Flickr - Sign in with Del.icio.us - Download from Google Play - Reserve with OpenTable - Digg this - Share on Reddit - Fund us on AngelList - Sign-in with Instagram - -

The Multi-Purpose Kids (Credit: Pictos Icons)

- - Call a phone - Send a message - Add to calendar - Add to cart - Print this page - Primary action - Secondary action - - -

Icon versions of the above

- Sign in with Facebook - Sign in with Google+ - Sign in with Twitter - Sign in with Google - Sign in with LinkedIn - Pay with Paypal - Sign in with Amazon - Sync with Dropbox - Clip to Evernote - Call me on Skype - Sign in as guest - Play on Spotify - Sign in with Last.fm - Sign in with Songkick - Follow me on Forrst - Sign in with Dribbble - Sign in to CloudApp - Fork me on Github - Follow me on Pinterest - Follow me on Quora - Bookmark with Pinboard - Attend on Lanyrd - Download on iTunes - Download on Android - Sign in with Disqus - Sign in with Yahoo - Upload to Vimeo - Add to Chrome - Get a new browser - Made from HTML5 - Read It Later - Read more on Scribd - View on Wikipedia - Tip with Flattr - Follow me on Tumblr - Subscribe to my Posterous - Check in with Gowalla - Check in with foursquare - Write a review on Yelp - Follow me on Soundcloud - Read on Smashing Magazine - Sign in with WordPress - Sign in with IntenseDebate - Sign in with OpenID - Sign in with Gmail - Sign in with Eventbrite - Sign in with Eventasaurus - Sign in with Meetup.com - Sign in with AIM - Follow me on Plancast - Subscribe on YouTube - Available on the Mac App Store - View Creative Commons Licence - Subscribe to RSS - Follow me on Weibo - Follow me on Plurk - Follow me on Grooveshark - Post on Blogger - Sign in with Viadeo - Subscribe to this Podcast - View Portfolio on 500px - Bitcoin accepted here - View Portfolio on 99Designs - Stumble! - Download on iTunes - Find me on Myspace - Sign in with Windows Live - Find Events with Eventful - Influence with Klout - Sign in with Xing - Upload to Flickr - Sign in with Del.icio.us - Download from Google Play - Reserve with OpenTable - Digg this - Share on Reddit - Fund us on AngelList - Sign-in with Instagram - Call a phone - Send a message - Add to calendar - Print this page - Add to cart - - - -

Thanks to @guillermovs, @kamens, @vizualover, and @leaverou for code refinements and suggestions.

- -

Massive thanks to @drewwilson for making the multi-purpose buttons possible with his incredible Pictos icons.

- -

See code samples at zocial.smcllns.com — ask questions to @smcllns

- - Tweet - - - - - - diff --git a/addons/auth_oauth/static/src/css/auth_oauth.css b/addons/auth_oauth/static/src/css/auth_oauth.css deleted file mode 100644 index 0489229042a..00000000000 --- a/addons/auth_oauth/static/src/css/auth_oauth.css +++ /dev/null @@ -1,34 +0,0 @@ -.openerp .oe_application .zocial { - font: white; -} - -.openerp .zocial.openerp:before { - content: "\E02E"; - font-style: italic; - text-shadow: 0 1px 1px black; -} - -.openerp a.zocial.openerp { - border: 1px solid #222222; - color: white; - margin: 0; - background-color: #b92020; - background-image: -webkit-gradient(linear, left top, left bottom, from(#b92020), to(#600606)); - background-image: -webkit-linear-gradient(top, #b92020, #600606); - background-image: -moz-linear-gradient(top, #b92020, #600606); - background-image: -ms-linear-gradient(top, #b92020, #600606); - background-image: -o-linear-gradient(top, #b92020, #600606); - background-image: linear-gradient(to bottom, #b92020, #600606); - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; - -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset; - text-shadow: none; - font-weight: normal; -} - -.openerp .oe_login .oe_oauth_provider_login_button { - margin-top: 4px; -} diff --git a/addons/auth_oauth/static/src/js/auth_oauth.js b/addons/auth_oauth/static/src/js/auth_oauth.js deleted file mode 100644 index a4295877e76..00000000000 --- a/addons/auth_oauth/static/src/js/auth_oauth.js +++ /dev/null @@ -1,81 +0,0 @@ -openerp.auth_oauth = function(instance) { - var _t = instance.web._t, - _lt = instance.web._lt; - var QWeb = instance.web.qweb; - - /* TODO: make this a server side controller - instance.web.Login.include({ - start: function(parent, params) { - var self = this; - var d = this._super.apply(this, arguments); - this.$el.hide(); - this.$el.on('click', 'a.zocial', this.on_oauth_sign_in); - this.oauth_providers = []; - if(this.params.oauth_error === 1) { - this.do_warn(_t("Sign up error"),_t("Sign up is not allowed on this database."), true); - } else if(this.params.oauth_error === 2) { - this.do_warn(_t("Authentication error"),_t("Access Denied"), true); - } else if(this.params.oauth_error === 3) { - this.do_warn(_t("Authentication error"),_t("You do not have access to this database or your invitation has expired. Please ask for an invitation and be sure to follow the link in your invitation email."), true); - } - return d.done(this.do_oauth_load).fail(function() { - self.do_oauth_load([]); - }); - }, - on_db_loaded: function(result) { - this._super.apply(this, arguments); - this.$("form [name=db]").change(this.do_oauth_load); - }, - do_oauth_load: function() { - var db = this.$("form [name=db]").val(); - if (db) { - this.rpc("/auth_oauth/list_providers", { dbname: db }).done(this.on_oauth_loaded); - } else { - this.$el.show(); - } - }, - on_oauth_loaded: function(result) { - this.oauth_providers = result; - var params = $.deparam($.param.querystring()); - if (this.oauth_providers.length === 1 && params.type === 'signup') { - this.do_oauth_sign_in(this.oauth_providers[0]); - } else { - this.$el.show(); - this.$('.oe_oauth_provider_login_button').remove(); - var buttons = QWeb.render("auth_oauth.Login.button",{"widget":this}); - this.$(".oe_login_pane form ul").after(buttons); - } - }, - on_oauth_sign_in: function(ev) { - ev.preventDefault(); - var index = $(ev.target).data('index'); - var provider = this.oauth_providers[index]; - return this.do_oauth_sign_in(provider); - }, - do_oauth_sign_in: function(provider) { - var return_url = _.str.sprintf('%s//%s/auth_oauth/signin', location.protocol, location.host); - if (instance.session.debug) { - return_url += '?debug'; - } - var state = this._oauth_state(provider); - var params = { - response_type: 'token', - client_id: provider.client_id, - redirect_uri: return_url, - scope: provider.scope, - state: JSON.stringify(state), - }; - var url = provider.auth_endpoint + '?' + $.param(params); - instance.web.redirect(url); - }, - _oauth_state: function(provider) { - // return the state object sent back with the redirected uri - var dbname = this.$("form [name=db]").val(); - return { - d: dbname, - p: provider.id, - }; - }, - }); - */ -}; diff --git a/addons/auth_oauth/static/src/xml/auth_oauth.xml b/addons/auth_oauth/static/src/xml/auth_oauth.xml deleted file mode 100644 index 76c71b83f10..00000000000 --- a/addons/auth_oauth/static/src/xml/auth_oauth.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/addons/auth_oauth/views/auth_oauth_login.xml b/addons/auth_oauth/views/auth_oauth_login.xml new file mode 100644 index 00000000000..f969d2f5eed --- /dev/null +++ b/addons/auth_oauth/views/auth_oauth_login.xml @@ -0,0 +1,19 @@ + + + + + + +