Skip to content

Commit

Permalink
Merge pull request #14 from shahronak47/1-safe-pass
Browse files Browse the repository at this point in the history
hash password using digest
  • Loading branch information
shahronak47 authored Aug 10, 2024
2 parents d1608cc + 746f781 commit e4a2d56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion global.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ library(shinyjs)
library(blastula)
library(bslib)
library(DT)
library(digest)
## Source files

options(repos = c("CRAN" = "https://cran.rstudio.com/"))
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e4a2d56

Please sign in to comment.