Make work on Fedora M1 and use faye on http for development
This commit is contained in:
+15
-5
@@ -36,11 +36,9 @@ class User
|
||||
#view :by_provider, key: [:provider, :uid]
|
||||
view :by_provider_and_uid, key: [:provider, :uid]
|
||||
|
||||
def self.find_for_oauth(auth_data, user)
|
||||
def self.find_for_oauth(auth_data, controller_current_user)
|
||||
#user = database.view(self.by_provider(key: [auth_data.provider, auth_data.uid], limit: 1)).first
|
||||
user = find_by_provider_and_uid(auth_data.provider, auth_data.uid)
|
||||
|
||||
user || create(
|
||||
attributes = {
|
||||
provider: auth_data.provider,
|
||||
uid: auth_data.uid,
|
||||
name: auth_data.info.nickname,
|
||||
@@ -49,7 +47,19 @@ class User
|
||||
oauth_token: auth_data.credentials.token,
|
||||
oauth_expires_at: auth_data.credentials.expires ? Time.at(auth_data.credentials.expires_at) : nil,
|
||||
auth_data: auth_data
|
||||
)
|
||||
}
|
||||
|
||||
if user = find_by_email(attributes[:email])
|
||||
# Update the provider attributes to keep the email unique and valid. This means that
|
||||
# if two people from other providers, with the same e-mail, can hijack the mozo account.
|
||||
# probability: around zero
|
||||
unless user.provider == attributes[:provider] and user.uid == attributes[:uid]
|
||||
user.update attributes
|
||||
end
|
||||
else
|
||||
user = create attributes
|
||||
end
|
||||
user
|
||||
end
|
||||
|
||||
# needed for cmtool
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
doctype html
|
||||
html lang="en"
|
||||
head
|
||||
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
|
||||
meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
|
||||
title= application_title
|
||||
/ = stylesheet_link_tag 'obtain_token/application'
|
||||
/ = csrf_meta_tags
|
||||
body
|
||||
- if flash[:alert].present?
|
||||
.alert.alert-error
|
||||
a.close data-dismiss="alert" ×
|
||||
div= flash[:alert]
|
||||
- if flash[:notice].present?
|
||||
.alert.alert-success
|
||||
a.close data-dismiss="alert" ×
|
||||
div= flash[:notice]
|
||||
#obtain-token-container= yield
|
||||
@@ -1,13 +1,18 @@
|
||||
doctype html
|
||||
html lang="en"
|
||||
head
|
||||
meta charset="utf-8"
|
||||
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
|
||||
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
||||
title Qwaiter
|
||||
= stylesheet_link_tag "user/foundation/application"
|
||||
= javascript_include_tag "vendor/modernizr"
|
||||
javascript:
|
||||
var Qstorage = localStorage;
|
||||
meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
|
||||
title= application_title
|
||||
/ = stylesheet_link_tag 'obtain_token/application'
|
||||
/ = csrf_meta_tags
|
||||
body
|
||||
= yield
|
||||
- if flash[:alert].present?
|
||||
.alert.alert-error
|
||||
a.close data-dismiss="alert" ×
|
||||
div= flash[:alert]
|
||||
- if flash[:notice].present?
|
||||
.alert.alert-success
|
||||
a.close data-dismiss="alert" ×
|
||||
div= flash[:notice]
|
||||
#obtain-token-container= yield
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if Rails.env.development?
|
||||
Qwaiter.event_host = "https://localhost:9296/faye"
|
||||
Qwaiter.event_host = "http://localhost:9296/faye"
|
||||
else
|
||||
Qwaiter.event_host = "https://events.mozo.bar:9296/faye"
|
||||
end
|
||||
|
||||
+21
-16
@@ -1,10 +1,11 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
base64 (0.3.0)
|
||||
coderay (1.1.3)
|
||||
cookiejar (0.3.3)
|
||||
cookiejar (0.3.4)
|
||||
daemons (1.4.1)
|
||||
em-http-request (1.1.7)
|
||||
addressable (>= 2.3.4)
|
||||
@@ -12,10 +13,11 @@ GEM
|
||||
em-socksify (>= 0.3)
|
||||
eventmachine (>= 1.0.3)
|
||||
http_parser.rb (>= 0.6.0)
|
||||
em-socksify (0.3.2)
|
||||
em-socksify (0.3.3)
|
||||
base64
|
||||
eventmachine (>= 1.0.0.beta.4)
|
||||
eventmachine (1.2.7)
|
||||
faye (1.4.0)
|
||||
faye (1.4.1)
|
||||
cookiejar (>= 0.3.0)
|
||||
em-http-request (>= 1.1.6)
|
||||
eventmachine (>= 0.12.0)
|
||||
@@ -23,22 +25,25 @@ GEM
|
||||
multi_json (>= 1.0.0)
|
||||
rack (>= 1.0.0)
|
||||
websocket-driver (>= 0.5.1)
|
||||
faye-websocket (0.11.1)
|
||||
faye-websocket (0.12.0)
|
||||
eventmachine (>= 0.12.0)
|
||||
websocket-driver (>= 0.5.1)
|
||||
websocket-driver (>= 0.8.0)
|
||||
http_parser.rb (0.8.0)
|
||||
method_source (1.0.0)
|
||||
multi_json (1.15.0)
|
||||
pry (0.14.1)
|
||||
logger (1.7.0)
|
||||
method_source (1.1.0)
|
||||
multi_json (1.17.0)
|
||||
pry (0.15.2)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
public_suffix (4.0.6)
|
||||
rack (2.2.3)
|
||||
thin (1.8.1)
|
||||
public_suffix (6.0.2)
|
||||
rack (3.2.0)
|
||||
thin (2.0.1)
|
||||
daemons (~> 1.0, >= 1.0.9)
|
||||
eventmachine (~> 1.0, >= 1.0.4)
|
||||
rack (>= 1, < 3)
|
||||
websocket-driver (0.7.5)
|
||||
logger
|
||||
rack (>= 1, < 4)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
|
||||
@@ -51,4 +56,4 @@ DEPENDENCIES
|
||||
thin
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
2.7.1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require 'faye'
|
||||
require 'pry'
|
||||
#require 'pry'
|
||||
# started using (with extra server contexts of cours like full paths):
|
||||
# thin start -d -R faye/config.ru -p 9296 --pid tmp/pids/faye.pid
|
||||
|
||||
@@ -6,7 +6,7 @@ pwd_dirname=$(basename $(pwd))
|
||||
script_dirname="faye"
|
||||
arch=$(uname)
|
||||
if [ $arch == "Darwin" ]; then
|
||||
certs_dir="/Users/bj/Library/Application Support/mkcert"
|
||||
certs_dir="~/.mkcert"
|
||||
else
|
||||
certs_dir="/etc/letsencrypt/live/mozo.bar"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# run using: thin start -C thin_config.yml
|
||||
---
|
||||
port: 9296
|
||||
rackup: config.ru
|
||||
# ssl: true
|
||||
# ssl-disable-verify: true
|
||||
# ssl-key-file: /home/bj/.mkcerts/localhost-key.pem
|
||||
# ssl-cert-file: /home/bj/.mkcerts/localhost.pem
|
||||
|
||||
Reference in New Issue
Block a user