Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
birger
users
Commits
519ab0b5
Commit
519ab0b5
authored
Aug 05, 2021
by
Birger Schacht
Browse files
Refactor email input groups
parent
9584f748
Pipeline
#8215
failed with stages
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
app/controllers/resources_controller.rb
View file @
519ab0b5
...
...
@@ -38,11 +38,8 @@ class ResourcesController < ApplicationController
@resource_name
=
params
[
:resource_name
]
if
list_of_canonical_resources
.
include?
@resource_name
data
=
{}
params
.
each
do
|
name
,
v
|
if
name
=~
/data_(.*)/
data
[
$1
]
=
v
end
end
data
[
'name'
]
=
params
[
:localpart
]
data
[
'domain'
]
=
params
[
:domain
]
@res
=
api
.
resource_self_create
(
@resource_name
,
data
)
update_account_properties
...
...
app/controllers/signup_controller.rb
View file @
519ab0b5
...
...
@@ -11,14 +11,14 @@ class SignupController < ApplicationController
def
create
(
redirect_to
'/signup'
and
return
)
unless
@token
@
email
=
params
[
:
email
]
@
localpart
=
params
[
:
localpart
]
@new_pw
=
params
[
:new
]
@enable_mail_crypt
=
true
@recovery_email
=
params
[
:recovery_email
]
@domain
=
params
[
:domain
]
@keep_recovery_token
=
params
[
:keep_recovery_token
]
full_email
=
"
#{
@
email
}
@
#{
@domain
}
"
full_email
=
"
#{
@
localpart
}
@
#{
@domain
}
"
if
EmailValidation
::
immerda_email_conform
(
full_email
)
begin
res
=
api
.
valid_new_email?
(
full_email
)
...
...
app/views/application/_email.html.erb
0 → 100644
View file @
519ab0b5
<div
class=
"form-group"
>
<div
class=
"input-group mb-1"
>
<%=
text_field_tag
(
'localpart'
,
""
,
class:
'form-control'
,
required:
true
)
%>
<div
class=
"input-group-prepend input-group-append"
>
<span
class=
"input-group-text"
>
@
</span>
</div>
<%=
domains
=
[
'immerda.ch'
]
if
domains
.
blank?
if
domains
.
length
==
1
text_field_tag
(
'domain'
,
domains
,
class:
'form-control'
,
readonly:
true
)
else
select_tag
(
'domain'
,
options_for_select
(
domains
,
'immerda.ch'
),
class:
'form-control'
)
end
%>
</div>
<small
id=
"emailHelp"
class=
"form-text text-muted"
>
<%=
t
(
:localpart_generate
)
%>
<%=
link_to
t
(
:username
),
'javascript:;'
,
onclick:
"randomUsername(update);"
%>
,
<%=
link_to
"
#{
t
(
:words
)
}
(en)"
,
'javascript:;'
,
onclick:
"randomProjectname(3, update);"
%>
or
<%=
link_to
"
#{
t
(
:words
)
}
(de)"
,
'javascript:;'
,
onclick:
"randomGermanProjectname(3, update);"
%>
</small>
</div>
<script>
function
update
(
name
)
{
var
v
=
document
.
getElementById
(
'
localpart
'
);
v
.
value
=
name
;
}
</script>
app/views/resources/create.html.erb
View file @
519ab0b5
...
...
@@ -33,24 +33,7 @@ allowed = [q['max'].to_i - q['cur'].to_i, 0].max
<%=
form_tag
do
%>
<%=
hidden_field_tag
'resource_name'
,
@resource_name
%>
<%
@resource_schema
.
each
do
|
n
,
v
|
%>
<div
class=
"form-group"
>
<%=
label_tag
n
%>
<%
if
n
==
'name'
%>
<%=
render
'random'
%>
<%
end
%>
<%=
case
v
when
Array
if
v
.
length
==
1
text_field_tag
(
'data_'
+
n
,
v
,
class:
'form-control'
,
readonly:
true
)
else
select_tag
(
'data_'
+
n
,
options_for_select
(
v
),
class:
'form-control'
)
end
else
text_field_tag
(
'data_'
+
n
,
""
,
class:
'form-control'
)
end
%>
</div>
<%
end
%>
<%=
render
'email'
,
domains:
@resource_schema
[
'domain'
]
%>
<%=
submit_tag
t
(
:create
),
name:
'create'
,
class:
"btn btn-primary"
%>
<%
end
%>
...
...
app/views/signup/create.html.erb
View file @
519ab0b5
...
...
@@ -10,13 +10,7 @@
<div
class=
"row pt-3"
>
<%=
form_tag
(
"
#{
signup_path
}
/
#{
URI
::
escape
(
@token
)
}
"
,
method:
"post"
)
do
%>
<div
class=
"form-group"
>
<%=
label_tag
(
:email
,
(
t
:email
))
%>
<%=
render
'random'
%>
<%=
text_field_tag
(
:email
,
''
,
value:
@email
||
'ig'
,
autofill:
'off'
,
class:
"form-control"
)
%>
@
<%=
select_tag
:domain
,
options_for_select
(
@domains
.
map
{
|
d
|
[
d
,
d
]},
'immerda.ch'
),
class:
"form-control"
%>
</div>
<%=
render
'email'
,
domains:
@domains
%>
<div
class=
"form-group"
>
<%=
label_tag
(
:new
,
(
t
:new_pw
))
%>
...
...
config/locales/de.yml
View file @
519ab0b5
...
...
@@ -212,6 +212,7 @@ de:
mail_alias
:
"
Email
Alias"
mail_alias_description
:
"
Eine
zweite
E-Mail
Adresse,
die
auf
dein
bestehendes
Postfach
zeigt.
Achtung,
wir
können
nicht
garantieren,
dass
dein
Alias
nie
mit
deiner
Hauptadresse
in
Verbindung
gebracht
werden
kann.
Wenn
du
dies
benötigst,
bestelle
bei
uns
ein
separates
zweites
Konto."
mail_alias_edit_description
:
"
"
localpart_generate
:
"
Generiere
zufällig
ähnlich
zu"
bills
:
Rechnungen
create_bill
:
Rechnung erstellen
...
...
config/locales/en.yml
View file @
519ab0b5
...
...
@@ -214,6 +214,7 @@ en:
mail_alias
:
"
Email
Alias"
mail_alias_description
:
"
A
second
address
pointing
to
your
existing
mailbox.
We
cannot
guarantee
that
your
alias
can
never
be
connected
to
your
main
address.
If
that
is
a
requirement
please
ask
us
for
a
second
mailbox."
mail_alias_edit_description
:
"
"
localpart_generate
:
"
Generate
at
random
similar
to"
bills
:
Bills
create_bill
:
Create invoice
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment