Update record of Authentication system in laravel without Error message - laravel

I used Authentication system and want to update record of user is "logged in" and use this code:
$data=User::find(Auth::user()->id);
//echo $date;
$data->gender=$request->gender;
$data->name=$request->username;
$data->mobile=$request->mobile;
$data->email=$request->email;
$data->address=$request->address;
$data->image=$request->image;
$data->save;
return redirect()->route('profile.view')->with('success',' User Updated successfuly');
but it doesn't update this record and doesn't receive an Error.

The problem was solved.I dont use "()" end of save ! thanks

Related

create an command which sends an email to the admin Laravel

Hello every one i wanna create an command which sends an email to the admin containing the modification / deletion report + access in a table (use the data in the log file) can someone help me please
for example this is my observer it log the actions in a file so how can i make a command which sends an email to the admin containing this actions from the log file ?
public function created(AppKey $appKey)
{
Log::channel('obsinfo')
->info("id : ".$appKey->id." type : ".$appKey->type." , datetime : ".now()." operation :Creation , ip :".\Request::ip()." userAgent: ".\Request::server('HTTP_USER_AGENT'));
return true;
}

Handling expired session in phoenix

I want to know how to prevent this error which I get for requesting an expired session. What could be a good way to do that? I checked Custom Errors, but not sure how helpful it is.
First, a UUID is created and set in the session.
uuid = SecureRandom.uuid
SessionStore.set uuid, id, ttl: 20
Then below URL link is sent to the user and when the user clicks, it should check if the UUID is expired in session or not.
<% verify_url = MyAppWeb.Router.Helpers.email_url(MyAppWeb.Endpoint, :verify, uuid: #uuid) %>
UUID is checked
def verify(conn, %{"uuid" => uuid}) do
user_id = SessionStore.get(uuid)
end
I just check the nil value first. I could also use a case as suggested in here.
if SessionStore.get(uuid) == nil do
IO.puts "uuid expired"
else
user_id = SessionStore.get(uuid)
user = Accounts.get_user!(user_id)
end

Skype4com auto accept contact request

I'm using a VBScript to auto accept Skype incoming contact request:
Public Sub Skype_UserAuthorizationRequestReceived(ByVal pUser)
pUser.IsAuthorized = true
End Sub
This works but is there a way to prevent Skype from alerting me through the tray?
I have already removed notification for contact request:
but it still appears.
It's also giving me a strange error:
Skype4COM.Skype.1: Invalid value given to ISAUTHORIZED/ISBLOCKED (code: 80020009)
I tried another approach of using
oSkype.Client.OpenAuthorizationDialog(pUser.Handle)
but it's giving an 'OPEN User already authorized' error.
I got an example that might help you.
Private Sub FRAccept(pUser As User)
If FlatToggle1.Checked = True And pUser.IsAuthorized = False Then
pUser.IsAuthorized = True
End If
End Sub

how to check that user is inactive for some specific duration?

I want to log out the user if he is inactive for some specific duration. USing sess_expiration in config file, it gives the timing from login not from inactive state.
So how can I do this using codeigniter?
you can store the time in a session when the user logging in like this:
$_SESSION['loginTime'] = time();
and when the user do any action in the system, check if the user exceed the specified time
if($_SESSION['loginTime'] < time()+$yourtime){
logout();
}else{
$_SESSION['loginTime'] = time();
}

get a new short-lived user access_token

I need to renew a long-lived access token. I read
Renew long lived access token server side topic and wrote a code as follows:
<?php
$code = $_REQUEST["code"];
if(empty($code)) {
$dialog_url = "https://www.facebook.com/dialog/oauth?"
. "client_id=$app_id"
. "&redirect_uri=$my_url"
. "&scope=..."
;
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
else
{
$response = file_get_contents("https://graph.facebook.com/oauth/access_token?"
. "client_id=$app_id"
. "&redirect_uri=$my_url"
. "&client_secret=$app_secret"
. "&code=$code"
);
$params = null;
parse_str($response, $params);
$access_token=$params['access_token'];
$response = file_get_contents("https://graph.facebook.com/oauth/access_token?"
. "client_id=$app_id"
. "&client_secret=$app_secret"
. "&redirect_uri=$my_url"
. "&grant_type=fb_exchange_token"
. "&fb_exchange_token=$access_token"
);
}
?>
On the first invocation it acquires 60-days access token all right. I expect that on the next invocations it would acquire another (may be with the same name) 60-days tokens, and I would see in the Debugger https://developers.facebook.com/tools/debug that issue time and expiration time changes, but the times do not change. What's wrong with my scenario?
Have you compared the tokens to each other? Facebook will send you back the existing access token when the same call is made in less than 24 hours. Also, tokens are set to not expire if you have also requested page tokens for the user. See my answer here: Facebook Page Access Tokens - Do these expire? for more info on this subject.
One way you can be sure to get a new token each time is if you revoke access by making an http DELETE call to /PROFILE_ID/permissions and then requesting a new token. The only bad thing about this is it will require you to put the user through the oAuth dialog again.

Resources