Make work on Fedora M1 and use faye on http for development

This commit is contained in:
2025-08-29 13:54:43 -05:00
parent 948a787bea
commit 6b02c05a99
8 changed files with 61 additions and 49 deletions
+15 -5
View File
@@ -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
-18
View File
@@ -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
+13 -8
View File
@@ -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