diff --git a/app/Http/Controllers/Api/CurrencyController.php b/app/Http/Controllers/Api/CurrencyController.php new file mode 100644 index 00000000..09e817cd --- /dev/null +++ b/app/Http/Controllers/Api/CurrencyController.php @@ -0,0 +1,15 @@ +validate([ + 'name' => ['required'], + 'email' => ['required', 'email', 'unique:users'], + 'password' => ['required', 'confirmed'], + 'currency' => ['required', 'exists:currencies,id'], + ]); + + $user = User::query() + ->create([ + 'name' => $request->input('name'), + 'email' => $request->input('email'), + 'password' => Hash::make($request->input('password')), + 'verification_token' => Str::random(100), + ]); + + $space = Space::query() + ->create([ + 'currency_id' => $request->input('currency'), + 'name' => $user->name . '\'s Space', + ]); + + $user->spaces()->attach($space->id, ['role' => 'admin']); + + (new SendVerificationMailAction())->execute($user->id); + + return [ + 'success' => true, + ]; + } +} diff --git a/app/Http/Resources/CurrencyResource.php b/app/Http/Resources/CurrencyResource.php new file mode 100644 index 00000000..ca800ebc --- /dev/null +++ b/app/Http/Resources/CurrencyResource.php @@ -0,0 +1,19 @@ + $this->id, + 'name' => $this->name, + 'symbol' => $this->symbol, + 'iso' => $this->iso, + ]; + } +} diff --git a/resources/assets/js/prototype/app.js b/resources/assets/js/prototype/app.js index c336c189..4405fdba 100644 --- a/resources/assets/js/prototype/app.js +++ b/resources/assets/js/prototype/app.js @@ -8,6 +8,7 @@ import translations from './translations'; import App from './components/App.vue'; import Login from './screens/Login.vue'; +import Register from './screens/Register.vue'; import Dashboard from './screens/Dashboard.vue'; import TransactionsIndex from './screens/Transactions/Index.vue'; import TransactionsCreate from './screens/Transactions/Create.vue'; @@ -27,6 +28,10 @@ const routes = [ path: '/prototype/login', name: 'login', component: Login, + }, { + path: '/prototype/register', + name: 'register', + component: Register, }, { path: '/prototype/dashboard', name: 'dashboard', diff --git a/resources/assets/js/prototype/screens/Login.vue b/resources/assets/js/prototype/screens/Login.vue index 45bf9a50..80986a5c 100644 --- a/resources/assets/js/prototype/screens/Login.vue +++ b/resources/assets/js/prototype/screens/Login.vue @@ -69,7 +69,9 @@ watch(showError, value => { -
{{ versionNumber }}
+
+ First time here? Register. +
diff --git a/resources/assets/js/prototype/screens/Register.vue b/resources/assets/js/prototype/screens/Register.vue new file mode 100644 index 00000000..6e0eca41 --- /dev/null +++ b/resources/assets/js/prototype/screens/Register.vue @@ -0,0 +1,96 @@ + + + diff --git a/resources/assets/js/prototype/translations/de.json b/resources/assets/js/prototype/translations/de.json index a2e314ac..3ef6c096 100644 --- a/resources/assets/js/prototype/translations/de.json +++ b/resources/assets/js/prototype/translations/de.json @@ -1,6 +1,7 @@ { "amount": "Betrag", "create": "Erstellen", + "currency": "Währung", "dailyBalanceGraphDescription": "Hier ist dein Kontostand im Laufe des Monats", "dashboard": "Dashboard", "date": "Datum", @@ -13,8 +14,11 @@ "goodMorning": "Guten Morgen", "language": "Sprache", "logIn": "Anmelden", + "name": "Name", "password": "Passwort", "recurringDescription": "Dies ist eine wiederkehrende Transaktion—erstelle sie auch in Zukunft für mich", + "register": "Registriere", + "repeatPassword": "Passwort wiederholen", "spending": "Ausgabe", "spendingDescriptionPlaceholder": "Geburtstagsgeschenk für Angela", "tag": "Schlagwort", diff --git a/resources/assets/js/prototype/translations/en.json b/resources/assets/js/prototype/translations/en.json index 472d9d74..0e4a4a17 100644 --- a/resources/assets/js/prototype/translations/en.json +++ b/resources/assets/js/prototype/translations/en.json @@ -1,6 +1,7 @@ { "amount": "Amount", "create": "Create", + "currency": "Currency", "dailyBalanceGraphDescription": "Here is your balance throughout the month", "dashboard": "Dashboard", "date": "Date", @@ -13,8 +14,11 @@ "goodMorning": "Good morning", "language": "Language", "logIn": "Log in", + "name": "Name", "password": "Password", "recurringDescription": "This is a recurring transaction—create it for me in the future", + "register": "Register", + "repeatPassword": "Repeat password", "spending": "Spending", "spendingDescriptionPlaceholder": "Birthday present for Angela", "tag": "Tag", diff --git a/resources/assets/js/prototype/translations/nl.json b/resources/assets/js/prototype/translations/nl.json index cb4ce9a2..c9006939 100644 --- a/resources/assets/js/prototype/translations/nl.json +++ b/resources/assets/js/prototype/translations/nl.json @@ -1,6 +1,7 @@ { "amount": "Bedrag", "create": "Creëer", + "currency": "Valuta", "dailyBalanceGraphDescription": "Dit is je balans gedurende deze maand", "dashboard": "Dashboard", "date": "Datum", @@ -13,8 +14,11 @@ "goodMorning": "Goedemorgen", "language": "Taal", "logIn": "Log in", + "name": "Naam", "password": "Wachtwoord", "recurringDescription": "Dit is een terugkerende transactie–maak deze in de toekomst voor mij aan", + "register": "Registreer", + "repeatPassword": "Herhaal wachtwoord", "spending": "Uitgave", "spendingDescriptionPlaceholder": "Verjaardagscadeau voor Angela", "tag": "Etiket", diff --git a/resources/assets/js/prototype/translations/ru.json b/resources/assets/js/prototype/translations/ru.json index 27406b9b..8e29a8ed 100644 --- a/resources/assets/js/prototype/translations/ru.json +++ b/resources/assets/js/prototype/translations/ru.json @@ -1,6 +1,7 @@ { "amount": "Сумма", "create": "Создать", + "currency": "Валюта", "dailyBalanceGraphDescription": "Здесь отображается ваш баланс в течение месяца", "dashboard": "Панель приборов", "date": "Дата", @@ -13,8 +14,11 @@ "goodMorning": "Доброе утро", "language": "Язык", "logIn": "Войти", + "name": "Имя", "password": "Пароль", "recurringDescription": "Это повторяющаяся транзакция—создайте ее для меня в будущем", + "register": "Зарегистрируй", + "repeatPassword": "Повтори пароль", "spending": "Расход", "spendingDescriptionPlaceholder": "Подарок на день рождения для Анжелы", "tag": "Тег", diff --git a/routes/api.php b/routes/api.php index 337fefbc..ab199e7d 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,15 +1,20 @@ group(function () {