Skip to content

Instantly share code, notes, and snippets.

View dipeshhkc's full-sized avatar
🏠
Working from home

Dipesh KC dipeshhkc

🏠
Working from home
View GitHub Profile
.btn-primary {
@apply inline-flex items-center px-4 py-1.5 text-sm font-medium border border-transparent outline-none rounded shadow-sm text-white bg-purple-500 hover:bg-purple-600;
}
.btn-secondary {
@apply inline-flex items-center px-4 py-1.5 text-sm font-medium border border-transparent outline-none rounded text-purple-400 bg-purple-500 hover:bg-purple-600;
}
.btn-danger {
@apply inline-flex items-center px-4 py-1.5 text-sm font-medium border border-transparent outline-none rounded shadow-sm text-white bg-red-500 hover:bg-red-600;
}
{
"scripts": {
"dev:css": "postcss styles --base styles --dir app/styles -w",
"build:css": "postcss styles --base styles --dir app/styles --env production",
"dev": "concurrently \"npm run dev:css\" \"remix dev\"",
"build": "npm run build:css && remix build"
}
}
module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('autoprefixer'),
]
}
import { Permissions } from "~/types/team";
import { db, enforcer } from "./db.server";
export const findPermissionInAnObj = async ({ user_id, obj }) => {
//find teams in which he is a member
const teams = await db.usersOnTeams.findMany({
where: {
user_id: user_id,
},
});
import { ActionFunction, json, redirect } from "remix";
import { db, enforcer } from "~/utils/db.server";
import { AuthActionData } from "~/types/auth";
import { authSchema } from "~/validations";
import { TeamMemberRoles } from "~/types/team";
const badRequest = (data: AuthActionData) => json(data, { status: 400 });
export const action: ActionFunction = async ({ request }) => {
const form = await request.formData();
const badRequest = (data: LoginActionData) => json(data, { status: 400 });
const loginSchema = yup.object().shape({
email: yup
.string()
.email("Email must be a valid email")
.required("Email is required"),
password: yup.string().required("Password is required"),
});
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sshCommand = ssh -i ~/.ssh/denmark_rsa -F /dev/null
[user]
name = dipesh
email = [email protected]
[remote "origin"]
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
func HashPassword(pass *string) {
bytePass := []byte(*pass)
hPass, _ := bcrypt.GenerateFromPassword(bytePass, bcrypt.DefaultCost)
*pass = string(hPass)
}
func ComparePassword(dbPass, pass string) bool {
return bcrypt.CompareHashAndPassword([]byte(dbPass), []byte(pass)) == nil
}
func (h userController) SignInUser(ctx *gin.Context) {
var user model.User
if err := ctx.ShouldBindJSON(&user); err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
}
dbUser, err := h.userRepo.GetByEmail(user.Email)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"msg": "No Such User Found"})
return