Present the user with a login interface before the exam begins. password_auth() requests the user to enter a username and password.

ui_token_auth() requires the user to enter only an access token.

password_auth(
  users,
  username_label = "Username",
  password_label = "Password",
  title = "Login",
  button_label = "Login",
  username_empty = "Username cannot be empty.",
  password_empty = "Passwort cannot be empty.",
  unauthorized = "The username/password are incorrect."
)

ui_token_auth(
  users,
  token_label = "Access token",
  title = "Login",
  button_label = "Login",
  token_empty = "Access token cannot be empty.",
  unauthorized = "The token is incorrect."
)

Arguments

users

a data frame with user authentication information. See below for details.

username_label

label for the username input field.

password_label

label for the password input field.

title

title of the dialog.

button_label

label for the login button.

username_empty

error messages for empty username field.

password_empty

error messages for empty password field.

unauthorized

error message for incorrect username/password.

token_label

label for the token input field.

token_empty

error messages for empty token field.

Details

The password_auth() authentication provider matches the given username and password against columns username and password in data frame users. The password column must contain hashed passwords created with sodium::password_store() (e.g., sodium::password_store("password"), or a SHA-256 HMAC created with digest::hmac() (digest::hmac("exam_id", "password", algo = "sha256")).

The ui_token_auth() authentication provider matches the given token and against column token in data frame users. The token can be any character data.

For both authentication providers, if the users data frame also contains columns display_name and/or grading, they are added to the user object (and used as described in the authentication provider documentation).

See also