나는 이라는 테이블과 3 열 (username
, password
, email
)이 있습니다. 사용자가 비밀번호를 잊어 버렸을 때, 이메일로 비밀번호를 받기 위해 이메일을 삽입해야합니다 (비밀번호 복구).전자 메일을 사용한 비밀번호 복구
- 왜 난 항상 메시지
User does not exist
를받을 수 있나요 :나는이 개 질문이?
- 두 번째
observe
에는 더 효율적인 방법이 있습니까pass
및msg
?
첫째
observe({
if (USER$Foget == TRUE){ # Foget is a flag
if (!is.null(input$back)){ #back is a button to go back to the main page
if (input$back > 0){
output$page <- renderUI({
div(class="outer",do.call(bootstrapPage,c("",ui1())))
})
}
}
}
if (USER$Foget == TRUE){
if (!is.null(input$PassRecall)){ #PassRecall is a button to send the email
if (input$PassRecall > 0){
Mail_to <- isolate(input$email)
query <- sprintf({"
SELECT password
FROM users
WHERE email='%s'"},
Mail_to, serialize=F)
db <- RSQLite::dbConnect(RSQLite::SQLite(), dbname="db.sqlite")
userr <- RSQLite::dbGetQuery(db, query)
RSQLite::dbDisconnect(db)
if (length(userr$rowid)>=1) {
USER$existed <- TRUE
}
}
}
print(ui)
}})
둘째
observe({
if (USER$Foget == TRUE) {
if (!is.null(input$PassRecall)){
if (input$PassRecall > 0){
if(USER$existed == TRUE){
Mail_from <- "[email protected]"
Mail_to <- isolate(input$email)
subject <- "password recovery"
pass <- unique(dbGetQuery(db,"SELECT password FROM users WHERE email=='Mail_to'"))
msg <- "You password is: 'pass'"
sendmail(Mail_from, Mail_to, subject, msg)
showNotification("Please, Check your Email !", duration = 5, type = c("message"))
}
}
}
}
if (USER$Foget == TRUE) {
if (!is.null(input$PassRecall)){
if (input$PassRecall > 0){
if(USER$existed == FALSE){
showNotification("User does not exist !", duration = 5, type = c("error"))
}
}
}
}})
실제 비밀번호를 저장하는 이유는 무엇입니까? – Dason
@Dason 마음에, "바비 테이블"은 어때? 또한 여기에 게시물 당 하나의 질문이 필요하며 "이 코드가 작동하지 않는 이유는 무엇입니까?"라는 완전한 코드 예제가 필요합니다. 질문. – Spacedman
@ 스페이스 맨, 너무 길기 때문에 전체 스크립트를 쓰는 것을 피하고 모든 스크립트를 혼동스럽게 만들면 잘 모르겠습니다. 어쨌든, 나는 나의 질문을 편집했다. –