mirror of
https://github.com/fergalmoran/radio-otherway.git
synced 2025-12-22 09:50:29 +00:00
Added TOS
This commit is contained in:
7
src/app/(boilerplate)/tos/page.tsx
Normal file
7
src/app/(boilerplate)/tos/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import TosComponent from "@/components/boilerplate/TosComponent";
|
||||
|
||||
const TosPage = () => {
|
||||
return <TosComponent />;
|
||||
};
|
||||
|
||||
export default TosPage;
|
||||
79
src/components/boilerplate/TosComponent.tsx
Normal file
79
src/components/boilerplate/TosComponent.tsx
Normal file
@@ -0,0 +1,79 @@
|
||||
import "./Boilerplate.css";
|
||||
|
||||
const TosComponent = () => {
|
||||
// @ts-ignore
|
||||
return (
|
||||
<>
|
||||
<h1>Website Terms and Conditions of Use</h1>
|
||||
|
||||
<h2>1. Terms</h2>;
|
||||
|
||||
<p>By accessing this Website, accessible from https://otherway.fergl.ie, you are agreeing to be bound by these Website
|
||||
Terms and Conditions of Use and agree that you are responsible for the agreement with any applicable local laws. If
|
||||
you disagree with any of these terms, you are prohibited from accessing this site. The materials contained in this
|
||||
Website are protected by copyright and trade mark law.</p>;
|
||||
|
||||
<h2>2. Use License</h2>;
|
||||
|
||||
<p>Permission is granted to temporarily download one copy of the materials on Radio Otherway's Website for personal,
|
||||
non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this
|
||||
license you may not:</p>;
|
||||
|
||||
<ul>
|
||||
<li>modify or copy the materials;</li>
|
||||
<li>use the materials for any commercial purpose or for any public display;</li>
|
||||
<li>attempt to reverse engineer any software contained on Radio Otherway's Website;</li>
|
||||
<li>remove any copyright or other proprietary notations from the materials; or</li>
|
||||
<li>transferring the materials to another person or "mirror" the materials on any other server.</li>
|
||||
</ul>;
|
||||
|
||||
<p>This will let Radio Otherway to terminate upon violations of any of these restrictions. Upon termination, your
|
||||
viewing right will also be terminated and you should destroy any downloaded materials in your possession whether it
|
||||
is printed or electronic format. These Terms of Service has been created with the help of the <a
|
||||
href="https://www.termsofservicegenerator.net">Terms Of Service Generator</a>.</p>;
|
||||
|
||||
<h2>3. Disclaimer</h2>;
|
||||
|
||||
<p>All the materials on Radio Otherway’s Website are provided "as is". Radio Otherway makes no warranties, may it be
|
||||
expressed or implied, therefore negates all other warranties. Furthermore, Radio Otherway does not make any
|
||||
representations concerning the accuracy or reliability of the use of the materials on its Website or otherwise
|
||||
relating to such materials or any sites linked to this Website.</p>;
|
||||
|
||||
<h2>4. Limitations</h2>;
|
||||
|
||||
<p>Radio Otherway or its suppliers will not be hold accountable for any damages that will arise with the use or
|
||||
inability to use the materials on Radio Otherway’s Website, even if Radio Otherway or an authorize representative of
|
||||
this Website has been notified, orally or written, of the possibility of such damage. Some jurisdiction does not
|
||||
allow limitations on implied warranties or limitations of liability for incidental damages, these limitations may
|
||||
not apply to you.</p>;
|
||||
|
||||
<h2>5. Revisions and Errata</h2>;
|
||||
|
||||
<p>The materials appearing on Radio Otherway’s Website may include technical, typographical, or photographic errors.
|
||||
Radio Otherway will not promise that any of the materials in this Website are accurate, complete, or current. Radio
|
||||
Otherway may change the materials contained on its Website at any time without notice. Radio Otherway does not make
|
||||
any commitment to update the materials.</p>;
|
||||
|
||||
<h2>6. Links</h2>;
|
||||
|
||||
<p>Radio Otherway has not reviewed all of the sites linked to its Website and is not responsible for the contents of
|
||||
any such linked site. The presence of any link does not imply endorsement by Radio Otherway of the site. The use of
|
||||
any linked website is at the user’s own risk.</p>;
|
||||
|
||||
<h2>7. Site Terms of Use Modifications</h2>;
|
||||
|
||||
<p>Radio Otherway may revise these Terms of Use for its Website at any time without prior notice. By using this
|
||||
Website, you are agreeing to be bound by the current version of these Terms and Conditions of Use.</p>;
|
||||
|
||||
<h2>8. Your Privacy</h2>;
|
||||
|
||||
<p>Please read our Privacy Policy.</p>;
|
||||
|
||||
<h2>9. Governing Law</h2>;
|
||||
|
||||
<p>Any claim related to Radio Otherway's Website shall be governed by the laws of ie without regards to its conflict
|
||||
of law provisions.</p>;</>
|
||||
);
|
||||
};
|
||||
|
||||
export default TosComponent;
|
||||
0
src/components/boilerplate/tmp/index.html
Normal file
0
src/components/boilerplate/tmp/index.html
Normal file
60
src/lib/auth/loginFunctions.ts
Normal file
60
src/lib/auth/loginFunctions.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
const LoginFunctions = {
|
||||
// PROVIDER_ID of auth provider, the credential object, and the email of the user
|
||||
signInOrLink: async function(provider, credential, email) {
|
||||
this.saveCredential(provider, credential);
|
||||
await auth().signInWithCredential(credential).catch(
|
||||
async (error) => {
|
||||
try {
|
||||
if (error.code != "auth/account-exists-with-different-credential") {
|
||||
throw error;
|
||||
}
|
||||
let methods = await auth().fetchSignInMethodsForEmail(email);
|
||||
let oldCred = await this.getCredential(methods[0]);
|
||||
let prevUser = await auth().signInWithCredential(oldCred);
|
||||
auth().currentUser.linkWithCredential(credential);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
getCredential: async function(provider) {
|
||||
try {
|
||||
let value = await AsyncStorage.getItem(provider);
|
||||
if (value !== null) {
|
||||
let [token, secret] = JSON.parse(value);
|
||||
return this.getProvider(provider).credential(token, secret);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
saveCredential: async function(provider, credential) {
|
||||
try {
|
||||
let saveData = JSON.stringify([credential.token, credential.secret]);
|
||||
await AsyncStorage.setItem(
|
||||
provider,
|
||||
saveData
|
||||
);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
getProvider: function(providerId) {
|
||||
switch (providerId) {
|
||||
case auth.GoogleAuthProvider.PROVIDER_ID:
|
||||
return auth.GoogleAuthProvider;
|
||||
case auth.FacebookAuthProvider.PROVIDER_ID:
|
||||
return auth.FacebookAuthProvider;
|
||||
case auth.TwitterAuthProvider.PROVIDER_ID:
|
||||
return auth.TwitterAuthProvider;
|
||||
default:
|
||||
throw new Error(`No provider implemented for ${providerId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
export default LoginFunctions;
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
createUserWithEmailAndPassword,
|
||||
FacebookAuthProvider,
|
||||
getAuth,
|
||||
GoogleAuthProvider,
|
||||
GoogleAuthProvider, linkWithPopup,
|
||||
onAuthStateChanged,
|
||||
signInWithEmailAndPassword,
|
||||
signInWithPopup, signInWithRedirect,
|
||||
@@ -14,6 +14,8 @@ import { app } from "./firebase";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Profile } from "@/models";
|
||||
import { FirebaseAuth } from "@firebase/auth-types";
|
||||
import firebase from "firebase/app";
|
||||
import LoginFunctions from "@/lib/auth/loginFunctions";
|
||||
|
||||
|
||||
export default function useFirebaseAuth() {
|
||||
@@ -63,8 +65,20 @@ export default function useFirebaseAuth() {
|
||||
|
||||
const _processSignIn = async (provider: any) => {
|
||||
try {
|
||||
const result = await signInWithPopup(auth, provider);
|
||||
|
||||
try {
|
||||
const result = await signInWithPopup(auth, provider);
|
||||
} catch (error: any) {
|
||||
if (error.code === "auth/account-exists-with-different-credential") {
|
||||
linkWithPopup(result.currentUser, provider).then((result) => {
|
||||
// Accounts successfully linked.
|
||||
const credential = GoogleAuthProvider.credentialFromResult(result);
|
||||
}).catch((error) => {
|
||||
console.log("useFirebaseAuth", "_processSignIn", "Failure in _processSignIn", err);
|
||||
// Handle Errors here.
|
||||
// ...
|
||||
});
|
||||
}
|
||||
}
|
||||
if (result.user) {
|
||||
const profile = getUserProfile();
|
||||
setProfile(profile);
|
||||
@@ -78,15 +92,16 @@ export default function useFirebaseAuth() {
|
||||
}
|
||||
};
|
||||
const signInWithGoogle = async () => {
|
||||
debugger
|
||||
const provider = new GoogleAuthProvider();
|
||||
provider.setCustomParameters({ prompt: "select_account" });
|
||||
provider.addScope("https://www.googleapis.com/auth/userinfo.profile");
|
||||
await _processSignIn(provider);
|
||||
const credential = await signInWithPopup(auth, provider);
|
||||
return LoginFunctions.signInOrLink(GoogleAuthProvider.PROVIDER_ID, credential, credential.user.email);
|
||||
// await _processSignIn(provider);
|
||||
};
|
||||
const signInWithTwitter = async () => {
|
||||
const provider = new TwitterAuthProvider();
|
||||
await _processSignIn(provider);
|
||||
const credential = new TwitterAuthProvider();
|
||||
return LoginFunctions.signInOrLink(GoogleAuthProvider.PROVIDER_ID, credential, credential.user.email);
|
||||
};
|
||||
const signInWithFacebook = async () => {
|
||||
const provider = new FacebookAuthProvider();
|
||||
|
||||
Reference in New Issue
Block a user