Class AccountService

java.lang.Object
org.ctan.site.services.account.AccountService

public class AccountService extends Object
The class AccountService contains service methods for the CTAN site user.
  • Constructor Details

    • AccountService

      public AccountService(@NonNull @NonNull UserStore store, @NonNull @NonNull TicketStore ticketStore, @NonNull @NonNull AuthorStore authorStore, @NonNull @NonNull MailService mailService)
      This is the constructor for the class UserService.
      Parameters:
      store - the underlying store
      ticketStore - the ticket store
      authorStore - the author store
      mailService - the mail service
  • Method Details

    • isEmpty

      public static final boolean isEmpty(String s)
      The method isEmpty provides means to check whether the argument is null or the empty string.
      Parameters:
      s - the reference string
      Returns:
      true if the string is null or empty
    • login

      public AccountService.UserTo login(@NonNull @NonNull String account, @NonNull @NonNull String password)
      The method login provides means to login.
      Parameters:
      account - the account
      password - the password
      Returns:
      the user or null
    • refresh

      public AccountService.UserTo refresh(@NonNull @NonNull String account, @NonNull @NonNull String refresh)
      The method login provides means to login.
      Parameters:
      account - the account
      refresh - the refresh token
      Returns:
      the user or null
    • registerAccount

      public AccountService.To registerAccount(String account, String email, String name, Gender gender, String lang)
      The method registerAccount provides means to start the registration process.
      Parameters:
      account - the account
      email - the email
      name - the name
      gender - the gender
      lang - the locale to use
      Returns:
      the registered account
    • set

      public boolean set(@NonNull @NonNull String account, @NonNull @NonNull String attribute, @NonNull @NonNull String value)
      The method set provides means to set a single attribute of the user and save the result.
      Parameters:
      account - the account
      attribute - the attribute
      value - the value
    • setPasswdFromTicket

      public boolean setPasswdFromTicket(String ticket, String password)
      The method setPasswdFromTicket provides means to set the password from a ticket.
      Parameters:
      ticket - the ticket
      password - the password
      Returns:
      true iff the password could be stored
    • setPassword

      public boolean setPassword(@NonNull @NonNull String account, @NonNull @NonNull String password)
      The method setPassword provides means to set the password from a user.
      Parameters:
      account - the user name
      password - the new password
      Returns:
      true iff the password has been changed
    • verifyTicket

      public String verifyTicket(String key)
      The method verifyTicket provides means to check that a ticket exists and is not expired.
      Parameters:
      key - the ticket key
      Returns:
      the user name or null