Skip to content

Commit

Permalink
add user language option during register in admin ui
Browse files Browse the repository at this point in the history
  • Loading branch information
sebadob committed Aug 18, 2023
1 parent 0f1a176 commit ce5e51f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion frontend/src/components/admin/users/UserTileAddNew.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script>
import ExpandContainer from "$lib/ExpandContainer.svelte";
import * as yup from "yup";
import {REGEX_NAME} from "../../../utils/constants.js";
import {LANGUAGES, REGEX_NAME} from "../../../utils/constants.js";
import {globalGroupsNames, globalRolesNames} from "../../../stores/admin.js";
import {extractFormErrors} from "../../../utils/helpers.js";
import Button from "$lib/Button.svelte";
import {postUser} from "../../../utils/dataFetchingAdmin.js";
import ItemTiles from "$lib/itemTiles/ItemTiles.svelte";
import Input from "$lib/inputs/Input.svelte";
import OptionSelect from "$lib/OptionSelect.svelte";
export let idx = -1;
export let onSave;
Expand All @@ -16,6 +17,7 @@
let isLoading = false;
let expandContainer;
let language = 'EN';
let formValues = {
email: '',
family_name: '',
Expand Down Expand Up @@ -49,6 +51,9 @@
err = '';
isLoading = true;
let data = formValues;
data.language = language.toLowerCase();
let res = await postUser(formValues);
if (res.ok) {
formValues = {};
Expand Down Expand Up @@ -109,6 +114,16 @@
>
FAMILY NAME
</Input>

<div class="language">
<div class="label">
LANGUAGE
</div>
<div style="margin-top: .4rem">
<OptionSelect bind:value={language} options={LANGUAGES} />
</div>
</div>

<div class="tiles">
<div class="label font-label">
ROLES
Expand Down Expand Up @@ -166,6 +181,12 @@
font-size: .9rem;
}
.language {
margin: 7px 5px;
display: flex;
gap: .33rem;
}
.tiles {
margin-left: 5px;
}
Expand Down
1 change: 1 addition & 0 deletions rauthy-models/src/entity/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ impl User {
email: new_user.email,
given_name: new_user.given_name,
family_name: new_user.family_name,
language: new_user.language,
roles,
groups,
..Default::default()
Expand Down

0 comments on commit ce5e51f

Please sign in to comment.