{"action":"created","issue":{"url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/140","repository_url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk","labels_url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/140/comments","events_url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/140/events","html_url":"https://github.com/ladybirdweb/faveo-helpdesk/issues/140","id":167004810,"number":140,"title":"User who is created at Agent Panel can not login","user":{"login":"thanhpt","id":1169319,"avatar_url":"https://avatars.githubusercontent.com/u/1169319?v=3","gravatar_id":"","url":"https://api.github.com/users/thanhpt","html_url":"https://github.com/thanhpt","followers_url":"https://api.github.com/users/thanhpt/followers","following_url":"https://api.github.com/users/thanhpt/following{/other_user}","gists_url":"https://api.github.com/users/thanhpt/gists{/gist_id}","starred_url":"https://api.github.com/users/thanhpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thanhpt/subscriptions","organizations_url":"https://api.github.com/users/thanhpt/orgs","repos_url":"https://api.github.com/users/thanhpt/repos","events_url":"https://api.github.com/users/thanhpt/events{/privacy}","received_events_url":"https://api.github.com/users/thanhpt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-22T09:22:18Z","updated_at":"2016-07-22T09:39:14Z","closed_at":null,"body":"What : If Admin create an User account at User Directory, there is no way to use this account to login.\r\nWhy : Because there is no such logic that allow to set password nor either the logic to send the password/verification email to registered email.\r\nHow : Need to copy the logic which allow user to register a new account him/her self from client screen to agent screen\r\nHttp¥Controller¥Agent¥Helpdesk¥UserController.php\r\n\r\n```\r\nuse App\\Http\\Controllers\\Common\\SettingsController;\r\nuse App\\Http\\Controllers\\Common\\PhpMailController;\r\n\r\n\r\npublic function store(User $user, Sys_userRequest $request)\r\n{\r\n/*      \r\n* Password generation\r\n* Password is same as email\r\n*/      \r\n        $password = Hash::make($user->email);\r\n        $user->password = $password;    \r\n        $reset_code = str_random(60);\r\n        $user->remember_token = $reset_code;\r\ntry {\r\n            if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {\r\n                return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput();\r\n            } else {\r\n                $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get();\r\n                if (!count($code)) {\r\n                    return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput();\r\n                }\r\n            }\r\n\r\n            \r\n            $user->save();\r\n\r\n            $message12 = '';\r\n            $var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $user->user_name, 'email_address' => $request->input('email').'/'.$request->input('email'), 'password_reset_link' => url('account/activate/'.$reset_code)]);\r\n            if ($var == null) {\r\n                $message12 = Lang::get('lang.failed_to_send_email_contact_administrator');\r\n                return redirect('user')->with('warning', $message12);\r\n            } else {\r\n                $message12 = Lang::get('lang.User-Created-Successfully');\r\n            }\r\n\r\n            /* redirect to Index page with Success Message */\r\n            return redirect('user')->with('success', $message12);\r\n```\r\n\r\nThat's it!\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/comments/234500585","html_url":"https://github.com/ladybirdweb/faveo-helpdesk/issues/140#issuecomment-234500585","issue_url":"https://api.github.com/repos/ladybirdweb/faveo-helpdesk/issues/140","id":234500585,"user":{"login":"sujit223","id":11830376,"avatar_url":"https://avatars.githubusercontent.com/u/11830376?v=3","gravatar_id":"","url":"https://api.github.com/users/sujit223","html_url":"https://github.com/sujit223","followers_url":"https://api.github.com/users/sujit223/followers","following_url":"https://api.github.com/users/sujit223/following{/other_user}","gists_url":"https://api.github.com/users/sujit223/gists{/gist_id}","starred_url":"https://api.github.com/users/sujit223/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sujit223/subscriptions","organizations_url":"https://api.github.com/users/sujit223/orgs","repos_url":"https://api.github.com/users/sujit223/repos","events_url":"https://api.github.com/users/sujit223/events{/privacy}","received_events_url":"https://api.github.com/users/sujit223/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T09:39:14Z","updated_at":"2016-07-22T09:39:14Z","body":"@SarfrazS Please test this module."}}
{"actor":{"display_login":"sujit223"}}