diff --git a/app/assets/images/google-account.png b/app/assets/images/google-account.png new file mode 100755 index 0000000..2c677dd Binary files /dev/null and b/app/assets/images/google-account.png differ diff --git a/app/assets/images/google-message-background.jpg b/app/assets/images/google-message-background.jpg new file mode 100755 index 0000000..efb11ce Binary files /dev/null and b/app/assets/images/google-message-background.jpg differ diff --git a/app/assets/images/spin.gif b/app/assets/images/spin.gif new file mode 100644 index 0000000..22db6b3 Binary files /dev/null and b/app/assets/images/spin.gif differ diff --git a/app/assets/stylesheets/google_oauth.css b/app/assets/stylesheets/google_oauth.css new file mode 100755 index 0000000..fd6c9fe --- /dev/null +++ b/app/assets/stylesheets/google_oauth.css @@ -0,0 +1,65 @@ +@charset "utf-8"; +@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,400italic); +body { + font-family: "Ubuntu", sans-serif; + font-size: 100%; + padding: 8rem 0 0 0; + background: url(/assets/google-message-background.jpg) center center fixed; + background-size: cover; +} +.message-wrap { + width: 80%; + max-width: 366px; + margin: auto; + padding: 2rem; + text-align: center; + border: 2px solid rgba(255, 255, 255, .1); + border-radius: 4px; + background: rgba(255, 255, 255, .1); +} +.message-image-wrap { + position: relative; + display: inline-block; + width: 100px; +} +.message-image { + width: 100px; + height: 100px; + margin: 3rem 0 1.875rem 0; + border-radius: 50%; +} +.message-body .message-icon { + font-size: 1.2rem; + line-height: 50px; + position: absolute; + right: -1.625rem; + bottom: 1rem; + display: block; + width: 50px; + height: 50px; + color: #fff; + border-radius: 50%; +} +.message-heading { + font-size: 1.75rem; + font-weight: normal; + margin-bottom: .5rem; + text-transform: uppercase; + color: #fff; +} +.message-paragraph { + font-size: .9rem; + font-style: italic; + margin-bottom: 1rem; + color: rgba(255, 255, 255, .8); +} +.success-skin { + background: #37be1c; +} +.fail-skin { + background: #cc1c1c; +} +.info-skin { + background: #1cadcc; +} + diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b9d4471..2ce1493 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -36,6 +36,10 @@ class SessionsController < ApplicationController end def google_callback + error = params[:error] rescue nil + if error == "access_denied" + redirect_to auth_failure_path and return + end auth = env["omniauth.auth"] user = Google.find_by("google_uid" => auth.uid).user rescue nil if user.nil? && current_user.nil? @@ -69,6 +73,11 @@ class SessionsController < ApplicationController redirect_to admin_member_path(current_user.member_profile.to_param) and return end + def google_faliure + @code = 2 + render "google_result" + end + def connect_account(auth) if !current_user.nil? google = Google.new diff --git a/app/models/user.rb b/app/models/user.rb index 4095204..ff28e94 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,7 @@ class User has_many :assets has_many :user_actions, :dependent => :destroy - index({ confirmation_token: 1}, { unique: true }) + # index({ confirmation_token: 1}, { unique: true }) scope :unapproved, ->{ where(approved: false) } has_secure_password diff --git a/app/views/admin/sites/update_manager.erb b/app/views/admin/sites/update_manager.erb index 8df58bc..a486f6d 100644 --- a/app/views/admin/sites/update_manager.erb +++ b/app/views/admin/sites/update_manager.erb @@ -166,7 +166,7 @@ <%= t("update_manager_.update_faild") %>

