airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRAVATA-2509) Account confirmation, password reset emails not making it to user
Date Wed, 10 Jan 2018 19:48:00 GMT

    [ https://issues.apache.org/jira/browse/AIRAVATA-2509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16320951#comment-16320951
] 

ASF GitHub Bot commented on AIRAVATA-2509:
------------------------------------------

machristie closed pull request #79: [AIRAVATA-2509] Account confirmation, password reset emails
not making it to user
URL: https://github.com/apache/airavata-php-gateway/pull/79
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index 9ab27139f..8d27e80d1 100755
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,12 @@ composer.lock
 .env.php
 .DS_Store
 Thumbs.db
+pga_config.php
 
 /app/storage
-/themes
\ No newline at end of file
+/themes
+
+.idea
+.iws
+workspace.xml
+tasks.xml
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 083bff008..d18900c75 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -30,6 +30,7 @@ public function createAccountSubmit()
             "password" => self::PASSWORD_VALIDATION,
             "confirm_password" => "required|same:password",
             "email" => "required|email",
+            "confirm_email" => "required|same:email",
         );
 
         $messages = array(
@@ -40,7 +41,7 @@ public function createAccountSubmit()
         $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
             return Redirect::to("create")
-                ->withInput(Input::except('password', 'password_confirm'))
+                ->withInput(Input::except('password', 'confirm_password', 'email', 'confirm_email'))
                 ->withErrors($validator);
         }
 
@@ -52,7 +53,7 @@ public function createAccountSubmit()
 
         if (Keycloak::usernameExists($username)) {
             return Redirect::to("create")
-                ->withInput(Input::except('password', 'password_confirm'))
+                ->withInput(Input::except('password', 'confirm_password'))
                 ->with("username_exists", true);
         } else {
 
diff --git a/app/libraries/EmailUtilities.php b/app/libraries/EmailUtilities.php
index 561cd8826..ff9ce9e84 100644
--- a/app/libraries/EmailUtilities.php
+++ b/app/libraries/EmailUtilities.php
@@ -19,7 +19,12 @@ public static function sendVerifyEmailAccount($username, $firstName, $lastName,
         $body = str_replace("\$lastName", $lastName, $body);
         $body = str_replace("\$validTime", $validTime, $body);
 
-        EmailUtilities::sendEmail($subject, [$email], $body);
+        $recipient = array();
+        $recipient['firstName'] = $firstName;
+        $recipient['lastName'] = $lastName;
+        $recipient['email'] = $email;
+
+        EmailUtilities::sendEmail($subject, [$recipient], $body);
     }
 
     public static function verifyEmailVerification($username, $code){
@@ -47,7 +52,12 @@ public static function sendVerifyUpdatedEmailAccount($username, $firstName,
$las
         $body = str_replace("\$lastName", $lastName, $body);
         $body = str_replace("\$validTime", $validTime, $body);
 
-        EmailUtilities::sendEmail($subject, [$email], $body);
+        $recipient = array();
+        $recipient['firstName'] = $firstName;
+        $recipient['lastName'] = $lastName;
+        $recipient['email'] = $email;
+
+        EmailUtilities::sendEmail($subject, [$recipient], $body);
     }
 
     public static function verifyUpdatedEmailAccount($username, $code){
@@ -76,7 +86,12 @@ public static function sendPasswordResetEmail($username, $firstName, $lastName,
         $body = str_replace("\$lastName", $lastName, $body);
         $body = str_replace("\$validTime", $validTime, $body);
 
-        EmailUtilities::sendEmail($subject, [$email], $body);
+        $recipient = array();
+        $recipient['firstName'] = $firstName;
+        $recipient['lastName'] = $lastName;
+        $recipient['email'] = $email;
+
+        EmailUtilities::sendEmail($subject, [$recipient], $body);
     }
 
     public static function verifyPasswordResetCode($username, $code){
@@ -90,7 +105,7 @@ public static function verifyPasswordResetCode($username, $code){
     }
 
     //PGA sends email to Admin about new request
-    public static function gatewayRequestMail($firstName, $lastName, $email, $gatewayName){
+    public static function gatewayRequestMail($firstName, $lastName, $emails, $gatewayName){
 
         $emailTemplates = json_decode(File::get(app_path() . '/config/email_templates.json'));
         $subject = $emailTemplates->gateway_request->subject;
@@ -101,7 +116,13 @@ public static function gatewayRequestMail($firstName, $lastName, $email,
$gatewa
         $body = str_replace("\$lastName", $lastName, $body);
         $body = str_replace("\$gatewayName", $gatewayName, $body);
 
-        EmailUtilities::sendEmail($subject, $email, $body);
+        $recipients = array();
+        foreach($emails as $email) {
+            $recipient['email'] = $email;
+            array_push($recipients, $recipient);
+        }
+
+        EmailUtilities::sendEmail($subject, $recipients, $body);
 
     }
 
@@ -115,13 +136,15 @@ public static function gatewayUpdateMailToProvider($email, $gatewayId){
         $body = str_replace("\$url", URL::to('/') . '/admin/dashboard', $body);
         $body = str_replace("\$gatewayId", $gatewayId, $body);
 
+        $recipient = array();
+        $recipient['email'] = $email;
 
-        EmailUtilities::sendEmail($subject, [$email], $body);
+        EmailUtilities::sendEmail($subject, [$recipient], $body);
 
     }
 
     //PGA sends email to Admin when Gateway is UPDATED
-    public static function gatewayUpdateMailToAdmin($email, $gatewayId){
+    public static function gatewayUpdateMailToAdmin($emails, $gatewayId){
 
         $emailTemplates = json_decode(File::get(app_path() . '/config/email_templates.json'));
         $subject = $emailTemplates->update_to_admin->subject;
@@ -130,7 +153,13 @@ public static function gatewayUpdateMailToAdmin($email, $gatewayId){
         $body = str_replace("\$url", URL::to('/') . '/admin/dashboard/gateway', $body);
         $body = str_replace("\$gatewayId", $gatewayId, $body);
 
-        EmailUtilities::sendEmail($subject, $email, $body);
+        $recipients = array();
+        foreach($emails as $email) {
+            $recipient['email'] = $email;
+            array_push($recipients, $recipient);
+        }
+
+        EmailUtilities::sendEmail($subject, $recipients, $body);
 
     }
 
@@ -159,7 +188,12 @@ public static function sendEmail($subject, $recipients, $body){
         $mail->ContentType = 'text/html; charset=utf-8\r\n';
 
         foreach($recipients as $recipient){
-            $mail->addAddress($recipient);
+            if (array_key_exists('firstName', $recipient) && array_key_exists('lastName',
$recipient)) {
+                $mail->addAddress($recipient['email'], $recipient['firstName'] . " " .
$recipient['lastName']);
+            }
+            else {
+                $mail->addAddress($recipient['email']);
+            }
         }
 
         $mail->Subject = $subject;
diff --git a/app/views/account/create.blade.php b/app/views/account/create.blade.php
index c86e223c3..f931ac9e4 100644
--- a/app/views/account/create.blade.php
+++ b/app/views/account/create.blade.php
@@ -72,8 +72,14 @@
 
             <div><input class="form-control" id="email" name="email" placeholder="email@example.com"
                         required="required" title="" type="email" value="{{Input::old('email')
}}"
-                         data-toggle="popover" data-placement="left" data-content="Please
make sure that you enter a correct email address as a verification mail will be sent to this
addresss."/></div>
+                         data-toggle="popover" data-placement="left" data-content="Please
make sure that you enter a correct email address as a verification mail will be sent to this
address."/></div>
         </div>
+        <div class="form-group required"><label class="control-label">E-mail
(again)</label>
+
+                <div><input class="form-control" id="confirm_email" name="confirm_email"
placeholder="email@example.com (again)"
+                            required="required" title="" type="email" value="{{Input::old('confirm_email')
}}"
+                            data-toggle="popover" data-placement="left" data-content="Please
make sure that you enter the same email address as above as a verification mail will be sent
to this address."/></div>
+            </div>
         <div class="form-group required"><label class="control-label">First Name</label>
 
             <div><input class="form-control" id="first_name" maxlength="30" name="first_name"


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Account confirmation, password reset emails not making it to user
> -----------------------------------------------------------------
>
>                 Key: AIRAVATA-2509
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2509
>             Project: Airavata
>          Issue Type: Bug
>          Components: PGA PHP Web Gateway
>            Reporter: Marcus Christie
>            Assignee: Neeraj Lad
>            Priority: Critical
>              Labels: newbie
>
> Email confirmation emails (when creating an account) and password reset emails aren't
always making it to users.  There are at least a couple reasons for this:
> * the emails are getting flagged as spam and the user doesn't check the spam folder
> ** perhaps in some cases the emails never ever reach the user if they are marked as spam
and stopped at the email server
> * the user mis-types their email address
> Possible fixes:
> * Can we find out what is causing emails to be flagged as spam? Is there a way to make
the emails seem less "spammy"?
> ** See for example https://stackoverflow.com/a/396
> * Require that users type in their email address twice in order to confirm it. This should
help prevent typos.
> * Can we determine if an email bounces back? This might be tricky since I think email
bounce backs are asynchronous.  Perhaps having the user confirm their email address is the
best we can do.
> Workarounds:
> * use CILogon instead of account creation/password reset.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message