You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: passwords_controller.rb
    path of file: ./repos/workarea/storefront/app/controllers/workarea/storefront/users
    
    the code of the file until where you have to start completion: module Workarea
  class Storefront::Users::PasswordsController < Storefront::ApplicationCont
    
    def update
      reset = User::PasswordReset.find_by(token: params[:token]) rescue nil

      if reset.blank?
        flash[:error] = t('workarea.storefront.flash_messages.password_reset_expired')
        render :edit
      elsif reset.complete(params[:password])
        flash[:success] = t('workarea.storefront.flash_messages.password_reset')
        redirect_to login_path
      else
        flash[:error] = reset.errors.full_messages.to_sentence
        redirect_to reset_password_path(token: reset.token)
      end