aboutsummaryrefslogtreecommitdiffstats
path: root/app/Controllers/Http/UserController.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controllers/Http/UserController.js')
-rw-r--r--app/Controllers/Http/UserController.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js
index e367d99..dc92b21 100644
--- a/app/Controllers/Http/UserController.js
+++ b/app/Controllers/Http/UserController.js
@@ -48,9 +48,11 @@ class UserController {
48 // Validate user input 48 // Validate user input
49 const validation = await validateAll(request.all(), { 49 const validation = await validateAll(request.all(), {
50 firstname: 'required', 50 firstname: 'required',
51 lastname: 'required',
51 email: 'required|email|unique:users,email', 52 email: 'required|email|unique:users,email',
52 password: 'required', 53 password: 'required',
53 }); 54 });
55
54 if (validation.fails()) { 56 if (validation.fails()) {
55 return response.status(401).send({ 57 return response.status(401).send({
56 message: 'Invalid POST arguments', 58 message: 'Invalid POST arguments',
@@ -59,7 +61,7 @@ class UserController {
59 }); 61 });
60 } 62 }
61 63
62 const data = request.only(['firstname', 'email', 'password']); 64 const data = request.only(['firstname', 'lastname', 'email', 'password']);
63 65
64 // Create user in DB 66 // Create user in DB
65 let user; 67 let user;
@@ -68,6 +70,7 @@ class UserController {
68 email: data.email, 70 email: data.email,
69 password: data.password, 71 password: data.password,
70 username: data.firstname, 72 username: data.firstname,
73 lastname: data.lastname,
71 }); 74 });
72 } catch (e) { 75 } catch (e) {
73 return response.status(401).send({ 76 return response.status(401).send({
@@ -149,13 +152,13 @@ class UserController {
149 email: auth.user.email, 152 email: auth.user.email,
150 emailValidated: true, 153 emailValidated: true,
151 features: {}, 154 features: {},
152 firstname: 'Franz', 155 firstname: auth.user.username,
153 id: '82c1cf9d-ab58-4da2-b55e-aaa41d2142d8', 156 id: '82c1cf9d-ab58-4da2-b55e-aaa41d2142d8',
154 isPremium: true, 157 isPremium: true,
155 isSubscriptionOwner: true, 158 isSubscriptionOwner: true,
156 lastname: 'Franz', 159 lastname: auth.user.lastname,
157 locale: 'en-US', 160 locale: 'en-US',
158 ...settings || {}, 161 ...settings || {},
159 }); 162 });
160 } 163 }
161 164
@@ -185,13 +188,13 @@ class UserController {
185 email: auth.user.email, 188 email: auth.user.email,
186 emailValidated: true, 189 emailValidated: true,
187 features: {}, 190 features: {},
188 firstname: 'Franz', 191 firstname: auth.user.username,
189 id: '82c1cf9d-ab58-4da2-b55e-aaa41d2142d8', 192 id: '82c1cf9d-ab58-4da2-b55e-aaa41d2142d8',
190 isPremium: true, 193 isPremium: true,
191 isSubscriptionOwner: true, 194 isSubscriptionOwner: true,
192 lastname: 'Franz', 195 lastname: auth.user.lastname,
193 locale: 'en-US', 196 locale: 'en-US',
194 ...newSettings || {}, 197 ...newSettings || {},
195 }, 198 },
196 status: [ 199 status: [
197 'data-updated', 200 'data-updated',
@@ -246,6 +249,7 @@ class UserController {
246 email, 249 email,
247 password: hashedPassword, 250 password: hashedPassword,
248 username: 'Franz', 251 username: 'Franz',
252 lastname: 'Franz'
249 }); 253 });
250 254
251 return response.send('Your account has been created but due to this server\'s configuration, we could not import your Franz account data.\n\nIf you are the server owner, please set CONNECT_WITH_FRANZ to true to enable account imports.'); 255 return response.send('Your account has been created but due to this server\'s configuration, we could not import your Franz account data.\n\nIf you are the server owner, please set CONNECT_WITH_FRANZ to true to enable account imports.');
@@ -301,6 +305,7 @@ class UserController {
301 email: userInf.email, 305 email: userInf.email,
302 password: hashedPassword, 306 password: hashedPassword,
303 username: userInf.firstname, 307 username: userInf.firstname,
308 lastname: userInf.lastname
304 }); 309 });
305 } catch (e) { 310 } catch (e) {
306 const errorMessage = `Could not create your user in our system.\nError: ${e}`; 311 const errorMessage = `Could not create your user in our system.\nError: ${e}`;