saucelabs / the-internet

An example application that captures prominent and ugly functionality found on the web. Perfect for writing automated acceptance tests against.
http://the-internet.herokuapp.com
Apache License 2.0
782 stars 640 forks source link

Forgot Email give a "500 Internal Server Error" #84

Open emgg-test opened 1 year ago

emgg-test commented 1 year ago

When clicking on the Retrieve Error the page gives a "Internal Server Error"

Steps:

  1. At the home page select "Forgot Email"
  2. Enter an email address
  3. Click on "Retrieve Password"

Actual result: The browser shows "Internal Server Error" having a 500 server error

Expected result: The browser should be redirected to the page: https://the-internet.herokuapp.com/email_sent

ms6073 commented 4 months ago

FYI - this issue continues to persist!

parmaryash-stack commented 2 months ago

this is good answer.

brownEFX commented 1 month ago

Internal Server Error still persists. Please help

ms6073 commented 1 month ago

Internal Server Error still persists. Please help

Well based on the comment at the top of the email_sent.erb view file from 10-years ago, appears this has never worked! While I am not a ruby develper, if I had to make a guess, seems like there is an issue with the workflow starting at line 317 in server.rb

get '/forgot_password' do
    erb :forgot_password
  end

  set :email_username, ENV['SENDGRID_USERNAME'] || ''
  set :email_password, ENV['SENDGRID_PASSWORD'] || ''
  set :email_address, 'dhaeffner@gmail.com'
  set :email_service, ENV['EMAIL_SERVICE'] || 'gmail.com'
  set :email_domain, ENV['SENDGRID_DOMAIN'] || 'localhost.localdomain'

  post '/forgot_password' do
    require 'pony'
    Pony.mail(
      from:     "no-reply@the-internet.herokuapp.com",
      to:       params[:email],
      subject:  "Forgot Password from the-internet",
      body:     "A forgot password retrieval was initiated from http://the-internet.herokuapp.com/forgot_password to #{params[:email]}.

  If this were a real message, you would likely see a link or some relevant text that would help you retrieve a password.

  If you want to test login, visit http://the-internet.herokuapp.com/login and use the following credentials:

  username: tomsmith
  password: SuperSecretPassword!",
      via:      'smtp',
      via_options: {
        address:              'smtp.' + settings.email_service,
        port:                 '587',
        enable_starttls_auto: true,
        user_name:            settings.email_username,
        password:             settings.email_password,
        authentication:       :plain,
        domain:               settings.email_domain
      })

    redirect '/email_sent'
  end

  get '/email_sent' do
    erb :email_sent
  end