datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
386 stars 79 forks source link

Converted is_hashed_password as logical #45

Closed hijifres closed 4 years ago

hijifres commented 4 years ago

Hi,

Thanks for this great package.

create_db return an error when is_hashed_password = TRUE in the credentials data frame, as bellow :

credentials <- data.frame(
  user = c("admin"), 
  password = c(scrypt::hashPassword("admin")),
  start = c(NA), # optional (all others)
  expire = c(NA),
  admin = c(TRUE),
  comment = "Default admin user (change the password) .",
  is_hashed_password = TRUE,
  stringsAsFactors = FALSE
)

shinymanager::create_db(
  credentials_data = credentials,
  sqlite_path =":memory:",
  passphrase = NULL)
#> Error in stopifnot(length(dbname) == 1, !is.na(dbname)): object 'path' not found

Created on 2020-07-03 by the reprex package (v0.3.0)

Maybe not the best solution, but here a simple modification to make sure that is_hashed_password is evaluated as logical in write_db_encrypt function.

bthieurmel commented 4 years ago

Hi,

Thanks. I'll have a look to this. But you don't need to hash password and set is_hash_password using sqlite database. It's automatically done.

hijifres commented 4 years ago

Hi,

Thanks for you reply, as it's automatically done (i should have tried this before) it's not useful indeed.