diff --git a/assets/images/travis-crying.png b/assets/images/travis-crying.png new file mode 100644 index 00000000..e9508b0b Binary files /dev/null and b/assets/images/travis-crying.png differ diff --git a/assets/scripts/app/routes.coffee b/assets/scripts/app/routes.coffee index 0b9023e6..a9a034b5 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -87,6 +87,7 @@ Travis.Router.map -> @route 'tab', path: ':tab' @route 'first_sync' + @route 'insufficient_oauth_permissions' @route 'stats', path: '/stats' @route 'auth', path: '/auth' @@ -114,12 +115,7 @@ Travis.GettingStartedRoute = Travis.Route.extend renderTemplate: -> @render('no_owned_repos') -Travis.FirstSyncRoute = Travis.Route.extend - actions: - redirectToGettingStarted: -> - # do nothing, we are showing first sync, so it's normal that there is - # no owned repos - +Travis.SimpleLayoutRoute = Travis.Route.extend setupController: -> $('body').attr('id', 'home') @container.lookup('controller:repos').activate() @@ -130,6 +126,18 @@ Travis.FirstSyncRoute = Travis.Route.extend @render 'top', outlet: 'top' @_super.apply(this, arguments) +Travis.FirstSyncRoute = Travis.SimpleLayoutRoute.extend + actions: + redirectToGettingStarted: -> + # do nothing, we are showing first sync, so it's normal that there is + # no owned repos + +Travis.InsufficientOauthPermissionsRoute = Travis.SimpleLayoutRoute.extend + setupController: (controller) -> + @_super.apply this, arguments + existingUser = document.location.hash.match(/#existing[_-]user/) + controller.set('existingUser', existingUser) + Travis.IndexCurrentRoute = Travis.Route.extend Travis.SetupLastBuild, renderTemplate: -> @render 'repo' diff --git a/assets/scripts/app/templates/insufficient_oauth_permissions.hbs b/assets/scripts/app/templates/insufficient_oauth_permissions.hbs new file mode 100644 index 00000000..6160c9bb --- /dev/null +++ b/assets/scripts/app/templates/insufficient_oauth_permissions.hbs @@ -0,0 +1,30 @@ +
+ + +

+ Oops, looks like something went wrong! +

+

+ It looks like we don't have authorization to access your GitHub account.
+ Please review your GitHub settings and try again. +

+ +
+
+

+ More information on GithubAuth +

+
+ +
+

+ More information on GithubAuth +

+
+
+
+ {{#if existingUser}} +

This will be shown if #existing-user is added to the url

+ {{/if}} +
+
\ No newline at end of file diff --git a/assets/styles/auth.sass b/assets/styles/auth.sass index a3bb1fcf..13b59273 100644 --- a/assets/styles/auth.sass +++ b/assets/styles/auth.sass @@ -50,4 +50,46 @@ margin: 0 0 50px 0 height: 150px background: inline-image('travis-mascot-150.png') 50% 0 no-repeat - background-size: 150px 150px \ No newline at end of file + background-size: 150px 150px + +#insufficient-permissions + width: 850px + margin: 0 auto + padding-top: 30px + font-family: 'Source Sans Pro', Helvetica, sans-serif + font-size: 17px + line-height: 26px + text-align: center + + .insufficient-permissions-head + font-size: 35px + color: #337389 + font-weight: 800 + text-align: center + padding-bottom: 20px + margin: 0 + + .insufficient-permissions-more + color: #919191 + font-size: 20px + font-weight: 400 + text-align: center + padding: 0 + margin: 0 + + .sad-travis + border: 0px + padding-bottom: 30px + align: center + + .insufficient-permissions-row + display: inline-block + clear: all + padding-top: 30px + + .insufficient-permissions-column + padding-right: 28px + max-width: 380px + display: block + float: left + clear: all \ No newline at end of file diff --git a/lib/travis/web/api_redirect.rb b/lib/travis/web/api_redirect.rb index b13ef777..04cca3b8 100644 --- a/lib/travis/web/api_redirect.rb +++ b/lib/travis/web/api_redirect.rb @@ -4,7 +4,21 @@ class Travis::Web::ApiRedirect < Sinatra::Base disable :protection, :static set api_endpoint: 'https://api.travis-ci.org' - get '/:owner_name/:name.png' do + class NotPublicImages + Match = Struct.new(:captures) + + def initialize(pattern, except) + @except = except + @pattern = pattern + @captures = Match.new([]) + end + + def match(str) + @captures if str =~ @pattern && str !~ @except + end + end + + get NotPublicImages.new(%r{^/([^/]+)/([^/]+).png}, %r{^/images/}) do redirect! end @@ -14,6 +28,10 @@ class Travis::Web::ApiRedirect < Sinatra::Base private + def public_image? + params[:owner_name] == 'images' + end + def redirect!(path = nil) path = File.join(settings.api_endpoint, path || request.fullpath) redirect(path, 301) diff --git a/public/images/travis-crying.png b/public/images/travis-crying.png new file mode 100644 index 00000000..e9508b0b Binary files /dev/null and b/public/images/travis-crying.png differ