Browse Source

Send email change requests to new address

tags/v0.1.0
Immanuel Onyeka 3 years ago
parent
commit
f7548a49fb
6 changed files with 15 additions and 3 deletions
  1. +1
    -0
      app/Http/Controllers/OrderController.php
  2. +2
    -1
      app/Http/Controllers/UserController.php
  3. +1
    -0
      app/Models/User.php
  4. +5
    -1
      app/Notifications/ChangeEmail.php
  5. +1
    -0
      resources/js/panel/services.vue
  6. +5
    -1
      resources/js/panel/settings.vue

+ 1
- 0
app/Http/Controllers/OrderController.php View File

@@ -31,6 +31,7 @@ class OrderController extends Controller
if ($cost > $user->credits) { if ($cost > $user->credits) {
abort(520, 'Insufficient Credits'); abort(520, 'Insufficient Credits');
} }

$user->save(); $user->save();
$order->save(); $order->save();
} }


+ 2
- 1
app/Http/Controllers/UserController.php View File

@@ -116,7 +116,8 @@ class UserController extends Controller
$link = URL::temporarySignedRoute('reset-email', now()->addDays(30), $link = URL::temporarySignedRoute('reset-email', now()->addDays(30),
['user' => Auth::user()->id, 'email' => $request->email]); ['user' => Auth::user()->id, 'email' => $request->email]);


Auth::user()->notify(new ChangeEmail($link)); Auth::user()->notify(new ChangeEmail($link,
$request->email));




} }


+ 1
- 0
app/Models/User.php View File

@@ -51,4 +51,5 @@ class User extends Authenticatable implements MustVerifyEmail
public function transactions() { public function transactions() {
return $this->hasMany(Transaction::class); return $this->hasMany(Transaction::class);
} }

} }

+ 5
- 1
app/Notifications/ChangeEmail.php View File

@@ -12,14 +12,16 @@ class ChangeEmail extends Notification
use Queueable; use Queueable;


private $link; private $link;
private $email;
/** /**
* Create a new notification instance. * Create a new notification instance.
* *
* @return void * @return void
*/ */
public function __construct($link) public function __construct($link, $email)
{ {
$this->link = $link; $this->link = $link;
$this->email = $email;
} }


/** /**
@@ -44,6 +46,7 @@ class ChangeEmail extends Notification
return (new MailMessage) return (new MailMessage)
->line('An email change has been requested. Please confirm your new address by clicking the link below.') ->line('An email change has been requested. Please confirm your new address by clicking the link below.')
->action('Confirm', $this->link) ->action('Confirm', $this->link)
->to($this->email)
->line('If you do not recognize this activity, please disregard this email.'); ->line('If you do not recognize this activity, please disregard this email.');
} }


@@ -59,4 +62,5 @@ class ChangeEmail extends Notification
// //
]; ];
} }

} }

+ 1
- 0
resources/js/panel/services.vue View File

@@ -101,6 +101,7 @@ function select(service) {
this.amount = service.maximum; this.amount = service.maximum;
} }
this.selected = service this.selected = service
document.getElementById('overlay-error').textContent = ''
} }


function cost() { function cost() {


+ 5
- 1
resources/js/panel/settings.vue View File

@@ -95,7 +95,11 @@ function changePassword() {
headers: {'Content-Type': 'application/json', headers: {'Content-Type': 'application/json',
'Accept': 'application/json', 'Accept': 'application/json',
'X-XSRF-TOKEN': this.token}, 'X-XSRF-TOKEN': this.token},
body: JSON.stringify({'current_password': document.getElementById('current_password').value, 'password': document.getElementById('new_password').value, 'password_confirmation': document.getElementById('confirm_password').value}), body: JSON.stringify({'current_password':
document.getElementById('current_password').value,
'password': document.getElementById('new_password').value,
'password_confirmation':
document.getElementById('confirm_password').value}),
}).then(response => { }).then(response => {
response.json().then(data => {console.log(data)}) response.json().then(data => {console.log(data)})
if (response.ok) { if (response.ok) {


||||||
x
 
000:0
Loading…
Cancel
Save