Let's build it together

Taking to long? Contact us to improve your software

We use

Višegodišnje iskustvo

10+ godina u industriji

Iskustvo koje unapređuje tehnologiju i
transformiše vaš biznis

cozyfirm

main


AuthController.php

style.scss


namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Mail\Users\RestartPassword;
use App\Models\Models\Core\Country;
use App\Models\Models\UserModels\RestartToken;
use App\Models\User;
use App\Traits\Http\ResponseTrait;
use App\Traits\Users\UserBaseTrait;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;

class AuthController extends Controller{
use UserBaseTrait, ResponseTrait;
protected string $_path = 'public-part.auth.';
   /**
* Note: This website is still under construction; If you have any questions, please contact us over firmcozy@gmail.com!!!
*/
/**
* Return Auth view
*/
public function auth(){
return view($this->_path. 'auth');
}

    public function authenticate(Request $request): bool|string{
if(empty($request->email)) return json_encode(['code' => '1101', 'message' => __('Molimo da unesete Vaš email') ]);
if(empty($request->password)) return json_encode(['code' => '1102', 'message' => __('Molimo da unesete Vašu šifru') ]);

if(Auth::attempt(['email' => $request->email, 'password' => $request->password])){
$user = Auth::user();

if($user->email_verified_at == null){
Auth::logout();
return json_encode([
'code' => '1102',
'message' => __('Molimo Vas da verifikujete Vaš račun!!')
]);
}

$uri = route('system.home');
if($user->role == 'user' or $user->role == 'presenter') $uri = route('dashboard.my-profile');

return json_encode([
'code' => '0000',
'message' => __('Uspješno ste se prijavili!'),
'url' => $uri
]);

}else {
return json_encode([
'code' => '1100',
'message' => __('Pogrešni pristupni podaci. Molimo pokušajte ponovo!')
]);
}
}

/**
* @return \Illuminate\Http\RedirectResponse
* Destroy sessions and log user out
*/
public function logout(): \Illuminate\Http\RedirectResponse{
Auth::logout();
return redirect()->route('auth');
}

/* -------------------------------------------------------------------------------------------------------------- */
/*
* Register Form
*/

/**
* Return view for account creation
*/
public function createAccount(){
return view($this->_path. 'create-account', [
'prefixes' => Country::orderBy('phone_code')->get()->pluck('phone_code', 'id'),
'countries' => Country::orderBy('name_ba')->get()->pluck('name_ba', 'id'),
]);
}

/**
* @param Request $request
* @return bool|\Illuminate\Http\JsonResponse|string|void
*
* Ajax END-Point; Create new profile
*/
public function saveAccount(Request $request){
try{
/* Password cannot be empty */
if(!isset($request->password)) return $this->jsonResponse('1001', __('Unesite Vašu šifru'));

/* Check for unique email */
$user = User::where('email', $request->email)->first();
if($user) return $this->jsonResponse('1002', __('Odabrani email se već koristi'));

/* Add username to request */
$request['username'] = $this->getSlug($request->name);

/* Hash password and add token */
$request['password'] = Hash::make($request->password);
$request['api_token'] = hash('sha256', $request->email. '+'. time());
$request['birth_date'] = Carbon::parse($request->birth_date)->format('Y-m-d');

/* When user is created, UserObserver is called and email was sent */
/* Note: Data is logged into laravel.log */
$user = User::create($request->all());

if($user) return $this->jsonSuccess(__('Uspješno ste se kreirali korisnički račun!'), route('auth'));
}catch (\Exception $e){
return $this->jsonResponse('1101', __('Greška prilikom procesiranja podataka. Molimo da nas kontaktirate!'));
}
}
}

Cutting edge

Digitalna transformacija

Transformišemo ideje u digitalna rešenja
Vaš partner u IT inovacijama

Kontaktirajte nas

Slažem se sa uslovima korištenja.

Projekti

Različite branše

Inovativna rješenja za projekte koji
pomjeraju granice tehnologije

cozyfirm

Razvoj IT

PCBs

Ostale aktivnosti

U progresu
Ukupno 4

Projekat u fazi razvoja

1.
v0.1.0 cozyfirm
web
30+ commits
@aladinkapic @admirakeric
2.
colors-app
not available
60+ commits
@ssefe @admirakeric @garmelix @edinkahvedzic
3.
helemnejse-shop
shop
100+ commits
@admirakeric @aladinkapic @edinkahvedzic
4.
kont-videos
video library
50+ commits
@bocha12 @admirakeric @aladinkapic
Beta distribucija
Ukupno 1

Inicijalna faza projekta

1.
scout.reprezentacija.ba
social network
150+ commits
@aladinkapic @admirakeric @bocha12
Završeno
Ukupno 9

Projekti u produkcionom okruženju

1.
bbbb.ba
trivia
226 commits
@bocha12 @admirakeric @aladinkapic
2.
e-exam
online exams
194 commits
@admirakeric @aladinkapic @nedret
3.
fondacijaekipa
web
20+ commits
@bocha12 @aladinkapic
4.
real-estate
estates
95 commits
@admirakeric @aladinkapic @kenan
5.
talent-academy
school
200+ commits
@edin @bocha12 @aladinkapic
6.
training management system
tms
136 commits
@aladinkapic @admirakeric @bocha12
7.
weather-api
embedded
10+ commits
@bocha12 @admirakeric @aladinkapic
8.
znzkvi
trivia
176 commits
@admirakeric @bocha12
9.
znzkvi studio
tv show
67 commits
@aladinkapic @bocha12