This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Open(): | |
window.show() | |
var tween = create_tween() | |
tween.tween_property(window, "position:y", 300, 2).set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT) | |
tween.tween_property(window,"modulate:a",1,2) | |
tween.play() | |
func _on_window_close_requested(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Security.Cryptography; | |
using System.Security.Cryptography.X509Certificates; | |
using System.Collections.Generic; | |
using UnityEngine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const authenticate = async ({ headers: { authorization } }, Users) => { | |
const token = authorization && HEADER_REGEX.exec(authorization)[1]; | |
jwt.verify(token, process.env.JWT_SECRET, (err, decoded: any) => { | |
if (err) { | |
return undefined; | |
} | |
else { | |
return Users.findOne({ _id: new ObjectID(decoded._id) }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HEADER_REGEX = /bearer token-(.*)$/; | |
/** | |
* This is an extremely simple token. In real applications make | |
* sure to use a better one, such as JWT (https://jwt.io/). | |
*/ | |
module.exports.authenticate = async ({headers: {authorization}}, Users) => { | |
const email = authorization && HEADER_REGEX.exec(authorization)[1]; | |
return email && await Users.findOne({email}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signinUser: async (root, data, { mongo: { Users } }) => { | |
const user = await Users.findOne({ email: data.email.email }); | |
if (user === null) { | |
throw new Error("Email not found !!"); | |
} | |
const passwordIsGood = await bcrypt.compare(data.email.password, user.password); | |
if (passwordIsGood) { | |
const newToken = jwt.sign({ _id: user._id }, process.env.JWT_SECRET, { expiresIn: "1h" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signinUser: async (root, data, { mongo: { Users } }) => { | |
const user = await Users.findOne({ email: data.email.email }); | |
if (user === null) { | |
throw new Error("Email not found !!"); | |
} | |
const passwordIsGood = await bcrypt.compare(data.email.password, user.password); | |
if (passwordIsGood) { | |
return { token: `token-${user.email}`, user }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signinUser: async (root, data, { mongo: { Users } }) => { | |
const user = await Users.findOne({ email: data.email.email }); | |
if (user === null) { | |
throw new Error("Email not found !!"); | |
} | |
if (data.email.password === user.password) { | |
return { token: `token-${user.email}`, user }; | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signinUser: async (root, data, {mongo: {Users}}) => { | |
const user = await Users.findOne({email: data.email.email}); | |
if (data.email.password === user.password) { | |
return {token: `token-${user.email}`, user}; | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createUser: async (root, data, { mongo: { Users } }) => { | |
const user = await Users.findOne({ email: data.authProvider.email.email }); | |
if (user) { | |
// a user with the same email was found, throw an error | |
throw new Error("Email already exists"); | |
} | |
const hash = await bcrypt.hash(data.authProvider.email.password, 10); | |
const newUser = { | |
name: data.name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createUser: async (root, data, { mongo: { Users } }) => { | |
const user = await Users.findOne({ email: data.authProvider.email.email }); | |
if (user) { | |
// a user with the same email was found, throw an error | |
throw new Error("Email already exists"); | |
} | |
const newUser = { | |
name: data.name, | |
email: data.authProvider.email.email, |
NewerOlder