From 746f781e2545dce878208d2c4cb1c5eb7fa04018 Mon Sep 17 00:00:00 2001 From: shahronak47 Date: Sat, 10 Aug 2024 09:02:10 +0530 Subject: [PATCH] hash password using digest --- global.R | 3 ++- server.R | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/global.R b/global.R index 7cf43f8..dbd1596 100644 --- a/global.R +++ b/global.R @@ -7,6 +7,7 @@ library(shinyjs) library(blastula) library(bslib) library(DT) +library(digest) ## Source files options(repos = c("CRAN" = "https://cran.rstudio.com/")) @@ -17,7 +18,7 @@ all_packages <- rownames(tmp) correct_login <- function(user, pass, con) { out <- DBI::dbGetQuery(con, glue::glue("SELECT password from users where username = '{user}'")) - out$password %in% pass + out$password %in% digest::digest(pass) } is_valid_email <- function(email) { diff --git a/server.R b/server.R index 35e4d86..a0bc073 100644 --- a/server.R +++ b/server.R @@ -89,7 +89,8 @@ function(input, output, session) { observeEvent(input$code_btn, { if(input$code == rv$otp_code){ removeModal() - insert_in_table(input$sign_up_email, input$sign_up_username, input$sign_up_password, input$first_name, input$last_name, rv$otp_code, rv$con) + password <- digest::digest(input$sign_up_password) + insert_in_table(input$sign_up_email, input$sign_up_username, password, input$first_name, input$last_name, rv$otp_code, rv$con) shinyalert("Success!!", "Email address verified", type = "success", immediate = TRUE, timer = 3000) } else {