Skip to content

Instantly share code, notes, and snippets.

krissanawat101 krissnawat

Block or report user

Report or block krissnawat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View initilizeRecaptcha
<div className="form-group">
<label>Recaptcha Validation</label>
<Recaptcha
sitekey={process.env.REACT_APP_RECAPCHA_KEY}
render="explicit"
theme="light"
verifyCallback={response => {
setFieldValue("recaptcha", response);
}}
onloadCallback={() => {
View app.js
import React, {Component} from 'react'
import Navigator from './src/components/Navigator'
import {ThemeManager} from './src/components/ThemeManager'
import SplashScreen from 'react-native-splash-screen'
import firebase from 'react-native-firebase'
import AsyncStorage from '@react-native-community/async-storage'
class App extends Component {
constructor (props) {
super(props)
this.state = {}
View appdelegate.m
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <React/RCTBridge.h>
View api.js
const express = require("express");
const router = express.Router();
const Users = require("./models/user_schema");
const jwt = require("./jwt");
const bcrypt = require("bcrypt");
const formidable = require("formidable");
const path = require("path");
const fs = require("fs-extra");
const jsonwebtoken = require("jsonwebtoken");
View passwordforgot.js
app.post("/password/reset", async (req, res) => {
let expired_time = "60m";
const { email } = req.body;
Users.findOne({ email }, (err, user) => {
if (err || !user) {
return res.json({
result: "error",
message: "User with that email does not exist"
});
}
View activation.js
const schema = mongoose.Schema({
avatars: String,
username: String,
email: String,
first_name: { type: String, default: "" },
last_name: { type: String, default: "" },
phone: { type: String, default: "" },
address: { type: String, default: "" },
password: String,
status: { type: String, default: "not_activated" },
View userschema.js
app.post("/register", async (req, res) => {
try {
req.body.password = await bcrypt.hash(req.body.password, 8);
const { first_name, last_name, email } = req.body;
const token = jsonwebtoken.sign(
{ first_name, last_name, email },
"process.env.JWT_ACCOUNT_ACTIVATION",
{ expiresIn: "60m" }
);
View showPreviewImage.js
getData = async id => {
await axios
.get("http://localhost:8080/profile/id/" + id)
.then(response => {
console.log(response.data);
document.getElementById("avatars").src = "http://localhost:8080/images/"+response.data.avatars
// profile.setAttribute("src",);
this.setState({ response: response.data });
})
.catch(error => {
View index.js
require("dotenv").config({ path: __dirname + "/.env" });
const express = require("express");
const bcrypt = require("bcrypt");
const app = express();
const bodyParser = require("body-parser");
const cors = require("cors");
const formidable = require("formidable");
const path = require("path");
const fs = require("fs-extra");
app.use(express.static(__dirname + "/uploaded"));
View schema.js
const schema = mongoose.Schema({
avatars: String,
username: String,
email: String,
first_name: { type: String, default: "" },
last_name: { type: String, default: "" },
phone: { type: String, default: "" },
address: { type: String, default: "" },
password: String,
level: { type: String, default: "staff" },
You can’t perform that action at this time.